vechain / vechain-sdk-js

The official JavaScript SDK for VeChain.
24 stars 9 forks source link

blake2b compatibility with ThorDevKit.blake2b256 #949

Closed lucanicoladebiasi closed 3 months ago

lucanicoladebiasi commented 4 months ago

Having an JSON representation of the certiificate, the ThorDevKit.blake2b256 result is different from blake2b256 of the same.

lucanicoladebiasi commented 4 months ago

As immediate workaround, taking a certificate object and converting to

const json = JSON.stringify(certificate);

the following transformation

const buffer = Buffer.from(json, 'utf8');

results in identical results for

const hash0 = ThorDevKit.blake2b256(buffer)
const hash1 = blake2b256(buffer)
assert(hash0 == hash1).isTruley()