Tag: hmacsha1

python uuid5在javascript nodejs中相当于

我试图将python代码转换为节点js。 在将此代码转换为JS时需要帮助。 “` import uuid uuid_salt = '9909fa72-b690-55dd-ab71-a987953bb438' x = 'hello' uuid_salt = uuid.UUID(uuid_salt) salted_uuid = lambda x: str(uuid.uuid5(uuid_salt, x)) print salted_uuid(x) “` 预期产量 – 3e735408-7f83-53cf-b7ce-f9ef69e5ca43 我试图这样写,但输出不匹配 var uuid_salt = '9909fa72-b690-55dd-ab71-a987953bb438' var x = 'hello' var hmac = crypto.createHmac('sha1', uuid_salt); hmac.setEncoding('hex'); hmac.end(x, function () { hash = hmac.read(); console.log('hash >>> ', hash); }); 这里是从库实际的python函数复制粘贴 def […]