Tag: 向后兼容

为什么crypto.createHash在新版本中返回不同的输出?

问题 我有使用crypto.createHash生成md5散列的node.js模块。 最近我注意到crypto模块生成的hash在新版本中是不同的: 码 require('crypto').createHash('md5').update('¥').digest('hex') Node.js v0.10.0 输出: ab3af8566ddd20d7efc9b314abe90755 Node.js v6.1.0 输出: 07625e142e4ac5961de57472657a88c1 题 我想知道是什么原因,在新版本,我该如何解决这个问题? 更新 GitHub上的类似问题: https://github.com/nodejs/node/issues/6813 https://github.com/node-xmpp/client/issues/206