Files
Validation-Ledger-Tx-Store-…/lib/computeBinaryTransactionHash.mjs
2023-10-01 23:39:42 +02:00

14 lines
474 B
JavaScript

import { HashPrefix } from 'ripple-binary-codec/dist/hash-prefixes.js'
import { sha512Half } from 'ripple-binary-codec/dist/hashes.js'
import { Buffer as BufferPf } from "buffer/index.js";
const computeBinaryTransactionHash = txBlobHex => {
const prefix = HashPrefix.transactionID.toString('hex').toUpperCase()
const input = BufferPf.from(prefix + txBlobHex, 'hex')
return sha512Half(input).toString('hex').toUpperCase()
}
export {
computeBinaryTransactionHash,
}