sha512-crypt mysql and dovecot

旧街凉风 提交于 2019-12-03 06:21:26
Jim

The salt is saved as part of the password. For example calling:

ENCRYPT('firstpassword', CONCAT('$6$', 'FooBarBaz')) 

Gives

$6$FooBarBaz$.T.G.7FRJqZ6N2FF7b3BEkr5j37CWhwgvPOOoccrr0bvkBbNMmLCxzqQqKJbNhnhC.583dTBLEuZcDuQe7NEe.

This stores both the algorithm used (6 being SHA512) and the salt ('FooBarBaz') both delinated by $.

Edit: To check a password you can use:

password = ENCRYPT('user_input', `password`)

ENCRYPT will grab the salt from the stored password and use this when checking user_input.

Full credit to hek2mgl for the password check he detailed in this answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!