关于crypto的md5加密报错:

代码:

var crypto = require('crypto');
var md5 = crypto.createHash('md5'); //crypto模块功能是加密并生成各种散列
var oldpass = md5.update(oldpass).digest('hex');
var newpass = md5.update(newpass).digest('hex');

 如果md5.update只使用一次则不会出错,多次就会报错

修改为每次重新构建md5:

var crypto = require('crypto');
var oldpass = crypto.createHash('md5').update(oldpass).digest('hex');
var newpass = crypto.createHash('md5').update(newpass).digest('hex');

结果正确。

TypeError: HashUpdate fail的更多相关文章

  1. js object 常用方法总结

    Object.assign(target,source1,source2,...) 该方法主要用于对象的合并,将源对象source的所有可枚举属性合并到目标对象target上,此方法只拷贝源对象的自身 ...

  2. jQuery对象的操作

    参考一篇不错的文章:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object 1. ...

  3. Python 命令行之旅:深入 click 之参数篇

    作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  4. DRF源码-fields.py

    https://www.cnblogs.com/pyspark/p/8607801.html https://www.cnblogs.com/LYliangying/articles/9896548. ...

  5. SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 SignalR 简单示例 通过三个DEMO学会SignalR的三种实现方式 SignalR推送框架两个项目永久连接通讯使用 SignalR 集线器简单实例2 用SignalR创建实时永久长连接异步网络应用程序

    SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论   异常汇总:http://www ...

  6. 微信小程序--分享报错(thirdScriptError Cannot read property 'from' of undefined;at pages/index/index page onShareAppMessage function TypeError: Cannot read property 'from' of undefined)

    分享功能: onShareAppMessage: function (res) { if (res.from === 'button') { // 来自页面内转发按钮 console.log(res. ...

  7. 微信小程序开发——使用回调函数出现异常:TypeError: Cannot read property 'setData' of undefined

    关键技术点: 作用域问题——回调函数中的作用域已经脱离了调用函数了,因此需要在回调函数外边把this赋给一个新的变量才可以了. 业务需求: 微信小程序开发,业务逻辑需要,需要把获取手机号码的业务逻辑作 ...

  8. jquery each报 Uncaught TypeError: Cannot use 'in' operator to search for错误

    用$.each()来遍历后台传过来的json数据.直接遍历传过来的数据时就发生 Uncaught TypeError: Cannot use 'in' operator to search for 这 ...

  9. python中的TypeError错误解决办法

    新手在学习python时候,会遇到很多的坑,下面来具体说说其中一个. 在使用python编写面向对象的程序时,新手可能遇到TypeError: this constructor takes no ar ...

随机推荐

  1. Could not find a package configuration file provided by 'ecl_geometry' ,.................couldn't find required component 'ecl_geometry'

    sudo apt-get install ros-kinetic-ecl-geometry

  2. Jmeter 测试API接口 查看接口的幂等问题

    背景介绍: 比如一个注册接口,要求填入的手机号与DB中已有的不能重复, 如果手机号码重复,则此次注册失败,不会新增会员数据: 如果不重复,则注册成功(忽略其他因素). 但是用20个并发,同样的请求,请 ...

  3. 大数据学习:storm流式计算

    Storm是一个分布式的.高容错的实时计算系统.Storm适用的场景: 1.Storm可以用来用来处理源源不断的消息,并将处理之后的结果保存到持久化介质中. 2.由于Storm的处理组件都是分布式的, ...

  4. Windows中查找命令的路径 (类似Linux中的which命令)

    where is a direct equivalent: C:\Users\Joey>where cmdC:\Windows\System32\cmd.exeNote that in Powe ...

  5. Python 运算符重载

    https://www.cnblogs.com/hotbaby/p/4913363.html

  6. EF学习-获取实体框架01

    实体框架由 EF 设计器(包含在 Visual Studio 中)和 EF Runtime(在 NuGet 上提供)组成. EF 设计器包含在 Visual Studio 中 最新版本的实体框架设计器 ...

  7. LeetCode--204--计数质数

    问题描述: 统计所有小于非负整数 n 的质数的数量. 示例: 输入: 10 输出: 4 解释: 小于 10 的质数一共有 4 个, 它们是 2, 3, 5, 7 . 方法1:经典的判断是否为质数遍历( ...

  8. 20170624xlVBA生成通讯录文件

    Public Sub QqYunContactTransferCsvFile() '应用程序设置 Application.ScreenUpdating = False Application.Disp ...

  9. python-day21--sys模块

    sys模块是与python解释器交互的一个接口 1.sys.argv           命令行参数List,第一个元素是程序本身路径     # 传参 应用场景:权限控制 2.sys.path    ...

  10. JS-图片控制-动画管理模块

    animateManage.js ;(function(window,document,undefined){ var _aniQueue = [], //动画队列 --- ani:动画,Queue: ...