lycan/onionr-blocks.js

15 lines
283 B
JavaScript
Raw Normal View History

function reconstructHash(hash){
return hash.padStart(64, 0)
}
function verifyBlock(raw, hash){
var encoder = new TextEncoder("utf-8")
hash = reconstructHash(hash)
if (doHashHex(encoder.encode(raw)) != hash){
throw new Error("Hash does not match")
}
}