MySQL Hashing Function Implementation

前端 未结 7 1660
[愿得一人]
[愿得一人] 2020-12-05 03:31

I know that php has md5(), sha1(), and the hash() functions, but I want to create a hash using the MySQL PASSWORD() function. So far, the only way I can think of is to just

7条回答
  •  再見小時候
    2020-12-05 03:49

    Bad boys do that in bash with sha1sum ;)

    PHRASE="password"; P1=`echo -n "${PHRASE}"|sha1sum`; P2="*`echo -en $(echo -n ${P1%% *}|sed -E 's/([0-9a-f]{2})/\\\x\1/g')|sha1sum -b`"; PASS="${P2%% *}"; echo "${PASS^^}"
    

    OT, but anyway... :)

提交回复
热议问题