创建加密密码 [英] Create encrypted passwords

查看:90
本文介绍了创建加密密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个小的cakephp设置,没有忘记密码功能。我想要能够创建一个散列的密码,使用相同的安全散列方法和在网站中使用的密码。
有一种方法可以在一个本地php文件中重新创建一个可以输出哈希密码的安装程序,系统会理解?

解决方案

确保指定您正在使用的控制器中使用安全组件:

  var $ components = array('Security');然后,在动作(方法/函数...无论什么):


$ b


$ b

  $ myPassword ='pizzaRules!'; 
$ hashedPassword = Security :: hash($ myPassword,null,true);

结尾的 true 使用网站的盐。


I am using a small cakephp setup, with no forgot password functionality. I want to be able to create a hashed password, using the same security hashing method and cipherseed used in the site. Is there a way to recreate the setup in a local php file which would output a hashed password, the system would understand?

解决方案

Make sure to specify that you're using the Security Component in whatever controller you're working in:

var $components = array('Security');

Then, in the action (method/function...whatever):

$myPassword = 'pizzaRules!';
$hashedPassword = Security::hash($myPassword, null, true);

The true at the end says you want to use the site's salt.

这篇关于创建加密密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆