I have this hex string
0x6469643a737369643a7465737432343700000000000000000000000000000000
and trying to convert via blake2b 128
Expected result: 0x017d8f165615146b5af43b037ee14db4
Using https://www.shawntabrizi.com/substrate-js-utilities/
But in code I'm getting 6a3f369054a2150757e7a4a8a6f59996
Code
let newData = try encodedHexData.blake2b(128)
let newHex = newData.toHexString()
print("HEX::: ", newHex)
func blake2b(_ size: Int) throws -> Data {
do {
var hasher = try Blake2(.b2b, size: size / 8)
hasher.update(self)
return try hasher.finalize()
} catch {
throw error
}
}
what should be the correct way?
Ref: