Jump to content

[Question]Hash password


Go to solution Solved by SoNiice,

Recommended Posts

Hi 

I'm using pdo so my code look like this:

 $CreateAcount = $sth->prepare(  
                                        "INSERT INTO account.account (login, password, email, social_id, question1, answer1, web_ip, register_token) VALUES (:login, :password, :email, :socialId, :question, :answer, :webIp, :registerToken)"  
                                    );  
                                    $CreateAcount->execute(array(":login" => $login, ":password" => $password ,":email" => $email,":socialId" => $socialId,":question" => $question,":answer" => $answer,":webIp" => GetIP() ,"registerToken" => GetIP()));
                               

and here my question: How can I encrypt password ? Now when I write in field password e.g testpassword, in mysql password isn't encryptet, it's just "testpassword"

Can u help me? :)

 

Regards

Deucalion

Link to comment
https://metin2.dev/topic/4949-questionhash-password/
Share on other sites

  • Solution

The PASSWORD function ist from MySQL itself, but you also can do it in PHP directly like this:

<?php

$sPasswordHash = '*' . strtoupper(sha1(sha1($sPassword, true)))

This function will hash your password string to exactly that the same like MySQL5 PASSWORD function output.

  • Love 1
Link to comment
https://metin2.dev/topic/4949-questionhash-password/#findComment-31250
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.