How to use sha256 in php5.3.0

后端 未结 5 1765
时光取名叫无心
时光取名叫无心 2021-02-01 01:32

I\'m using sha256 to encrypt the password. I can save the sha256 encrypted password in mysql. But i can\'t login with the same clause.

Insert code:



        
5条回答
  •  有刺的猬
    2021-02-01 01:47

    The first thing is to make a comparison of functions of SHA and opt for the safest algorithm that supports your programming language (PHP).

    Then you can chew the official documentation to implement the hash() function that receives as argument the hashing algorithm you have chosen and the raw password.

    sha256 => 64 bits sha384 => 96 bits sha512 => 128 bits

    The more secure the hashing algorithm is, the higher the cost in terms of hashing and time to recover the original value from the server side.

    $hashedPassword = hash('sha256', $password);
    

提交回复
热议问题