You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the great library for hashing on AssemblyScript. I'm trying to hash a bitcoin transaction from data and using sha256Hash , but some returned incorrect data. I have reviewed the input data and found no problem so I am thinking sha256hash has some problem. Can you check again ?
My code :
let version: Uint8Array = Uint8Array.wrap(fundingTx.version.buffer);
let inputVector: Uint8Array = Uint8Array.wrap(fundingTx.inputVector.buffer);
let outputVector: Uint8Array = Uint8Array.wrap(fundingTx.outputVector.buffer);
let locktime: Uint8Array = Uint8Array.wrap(fundingTx.locktime.buffer);
let packed = new Uint8Array(version.length + inputVector.length + outputVector.length + locktime.length);
packed.set(version,0);
packed.set(inputVector, version.length);
packed.set(outputVector, version.length + inputVector.length);
packed.set(locktime, version.length + inputVector.length + outputVector.length);
const hashData = sha256Hash(sha256Hash(packed));
let fundingTxHash: string = bin2hex(hashData);
my data input is bytes , but I can display it as hex below :
response :
fundingTxHash = b8aa9b3408bfedc1ac27fc91ae3e8b97774c32e14f13798685ec417990e8aa74
but correct is : 437db270c650c8b3fc88903626c8c32caa363917d676060486fa50f522eba74d
hello,
Thank you for the great library for hashing on AssemblyScript. I'm trying to hash a bitcoin transaction from data and using sha256Hash , but some returned incorrect data. I have reviewed the input data and found no problem so I am thinking sha256hash has some problem. Can you check again ?
My code :
my data input is bytes , but I can display it as hex below :
Data 1 will return the correct data:
Data 2 will return incorrect data:
The text was updated successfully, but these errors were encountered: