How do I convert password hashing from MD5 to SHA?

前端 未结 7 740
谎友^
谎友^ 2020-12-29 08:06

I\'ve got an old application that has user passwords stored in the database with an MD5 hash. I\'d like to replace this with something in the SHA-2 family.

I\'ve tho

7条回答
  •  佛祖请我去吃肉
    2020-12-29 08:27

    Essentially the same, but maybe more elegant than adding extra fields: In the default authentication framwork in Django, the password hashes are stored as strings constructed like this:

    hashtype$salt$hash
    

    Hashtype is either sha1 or md5, salt is a random string used to salt the raw password and at last comes the hash itself. Example value:

    sha1$a1976$a36cc8cbf81742a8fb52e221aaeab48ed7f58ab4
    

提交回复
热议问题