3

I'm having a hard time figuring out how to convert a hex string into a checksum256/capi_checksum256 (or vice versa), any help?

2
  • Can you show some code for what you are doing? A checksum essentially digests a bunch of bits of arbitrary length into another string having fixed width of 256 bits. So if you treat your hex data as a string, and then apply a checksum on it, that should work out. Here's a test. – Gunnar Pope Nov 18 '18 at 2:12
  • @GunnarPope no I think he has a string that is of a checksum256 but wants to convert the type from a string to a checksum256 – nicholas labrecque Aug 18 '20 at 15:18
0

First of all, there is no vice versa in string or hex -> checksum or hash its only one way.
You cannot have string or hex back from checksum or hash. It only insures data integrity, not data authenticity
Secondly, Mitch has this great medium article on how it is done.
Here is the article
Repo for code is Here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.