Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (12.7k points)

I'm trying to use built-in function "sha256" in my Waves dApp.

'DataEntry("sha256_kotobytesto64", toBase64String(sha256(toBytes("Message to hash"))))'

But it seems like the result of this function is not the same as major open-source sha256 implementations (

Text: Message to hash

RIDE: 8apFsPX2cDRo+bm8K5h01PprABoXDQ8TKqWibQDQx+U=

Standart: f1aa45b0f5f6703468f9b9bc2b9874d4fa6b001a170d0f132aa5a26d00d0c7e5

How to solve it?

1 Answer

0 votes
by (29.5k points)

Hi,Those are the same value, encoded in different ways. The "RIDE" result is in base-64, and the "Standart [sic]" result is in hexadecimal (base-16).

You can use the python code below to convert one to other:

>>> import base64
>>> import binascii
>>> binascii.hexlify(base64.b64decode('8apFsPX2cDRo+bm8K5h01PprABoXDQ8TKqWibQDQx+U='))

Browse Categories