Using a hash of what you are hashing as a salt?

前端 未结 6 1902
情话喂你
情话喂你 2021-01-24 19:40

Say a user registers for your site, you hash the password they have chosen then use that hash as a salt and rehash their password with that salt.

Example:



        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-24 20:11

    Instead of hashing two times you should use the username as salt for the function:

    String hash = MD5(username + password)
    

    You should also consider using a different function as md5 is considered broken MD5

提交回复
热议问题