Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword” “{md5}hashedpassword”

泪湿孤枕 提交于 2019-12-11 03:25:22

问题


I have a table which stores user login infomration, which contains passwords in the below scheme

  • {crypt}hashedpassword
  • {ssha}hashedpasswordsalted
  • {md5}hashedpassword
  • .....

Is there a perl module that understands this scheme and is able to validate the password given the plain text password ?

Something like

print "success!!\n" if validatePassword("helloworld",{CRYPT}r2sKInajXZ6Fk)

Thanks.


回答1:


Authen::Passphrase can do this:

use Authen::Passphrase;

print "success!!\n" 
  if Authen::Passphrase->from_rfc2307('{CRYPT}r2sKInajXZ6Fk')->match("helloworld");


来源:https://stackoverflow.com/questions/5815322/is-there-a-perl-module-to-validate-passwords-stored-in-crypthashedpassword

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