需要将 SHA-256 哈希反转为字符串机制 [关闭]

问题描述 投票:0回答:0

下面的代码正在使用 SHA-256 方法对字符串进行哈希处理

const msgUint8 = new TextEncoder().encode(ID);                    
const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);   
const hashArray = Array.from(new Uint8Array(hashBuffer));               
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); 

我是加密和解密的新手,需要对上面的 SHA-256 片段进行反向操作,如果我提供 hashHex 值需要获取 ID 值

decode sha256 cryptojs subtlecrypto
© www.soinside.com 2019 - 2024. All rights reserved.