我正在尝试复制JS方法:
JS代码:
const toHexCopy = (buffer) => {
return [...new Uint8Array (buffer)]
.map (b => b.toString (16).padStart (2, "0"))
.join ("");
};
ar = new Uint8Array([0, 1, 2]);
hash = await crypto.subtle.digest('SHA-256', ar)
console.log(toHexCopy(hash))
// returns 039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81如何在Python中复制它?
发布于 2021-04-18 06:56:13
from hashlib import sha256
print(sha256(bytes([1, 2, 3])).hexdigest())https://stackoverflow.com/questions/67142853
复制相似问题