npm install bcryp --save 安装不成功,所以
用bcrypt-node.js来替换bcrypt,但是bcrypt-node的hash参数有四个
function hash(data, salt, progress, callback) {
/*
data - [REQUIRED] - the data to be encrypted.
salt - [REQUIRED] - the salt to be used to hash the password. if specified as a number then a salt will be generated and used (see examples).
progress - a callback to be called during the hash calculation to signify progress
callback - [REQUIRED] - a callback to be fired once the data has been encrypted. uses eio making it asynchronous.
error - First parameter to the callback detailing any errors.
encrypted - Second parameter to the callback providing the encrypted form.
*/
比bcrypt多了一个progress参数,该参数是一个回调函数
解决方法:
在bcrypt-node.js 的function hash(data, salt, progress, callback) 方法中加入
if(typeof callback == 'undefined') {
callback = progress;
progress = null;
}
而别的模块调用hash的时候progress参数设置为null即可,
bcrypt.hash(user.password, salt,null, function(err, hash)
分享到:
相关推荐
1. 安装:首先,你需要通过 npm(Node.js 的包管理器)来安装 bcrypt-node。在命令行中运行 `npm install bcrypt-nodejs` 或 `npm install bcrypt`(根据库的最新版本,可能会有所不同)。 2. 密码哈希:在用户注册...
python库。 资源全名:bcrypt-3.1.2-cp27-cp27mu-manylinux1_x86_64.whl
**bcrypt-nodejs** 是一个专为Node.js设计的JavaScript实现的bcrypt库,它允许开发者在前端和后端安全地处理用户密码。bcrypt是一种流行的密码哈希算法,它结合了Blowfish加密算法和一个可变的加盐过程,提供了一种...
资源来自pypi官网。 资源全名:bcrypt-3.1.0-cp26-cp26m-win_amd64.whl
资源分类:Python库 所属语言:Python 资源全名:bcrypt-3.1.7-cp38-cp38-win_amd64.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源来自pypi官网。 资源全名:bcrypt-3.1.0-cp26-cp26mu-manylinux1_i686.whl
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
python库。 资源全名:bcrypt-3.1.0-cp27-cp27m-win32.whl
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
**PyPI 官网下载 | bcrypt-1.1.1-cp27-none-win_amd64.whl** 本文将详细介绍PyPI(Python Package Index)官网下载的`bcrypt-1.1.1-cp27-none-win_amd64.whl`文件,以及与之相关的Python库`bcrypt`。`bcrypt`是一个...
**bcrypt-3.1.0-cp26-cp26mu-manylinux1_i686.whl** 是一个Python库的 wheel 文件,用于在Python环境中便捷安装bcrypt库。wheel 文件是预编译的Python软件包,它允许开发者无需源码即可快速安装库,避免了编译过程,...
**PyPI 官网下载 | bcrypt-3.1.4-cp34-cp34m-macosx_10_6_intel.whl** 在Python的开发环境中,`PyPI`(Python Package Index)是官方的软件仓库,提供了大量的第三方Python库,使得开发者能够方便地分享和使用各种...
bcrypt-ruby, bcrypt ruby 是用于 OpenBSD bcrypt() 密码散列算法的ruby 绑定,允许你轻松地存储...http://github.com/codahale/bcrypt-ruby/tree/master 为什么应该使用 bcrypt()如果你将用户密码存储在明文中,那么
支持的算法名称Crates.io文档PBKDF2 scrypt bcrypt-pbkdf许可您可以选择根据Apache许可,2.0版MIT许可中的任何一个许可使用所有箱子。 稿件除非您明确声明,否则,您有意按定义将任何稿件提交给您的作品
资源来自pypi官网。 资源全名:bcrypt-3.1.2-cp35-cp35m-manylinux1_i686.whl