2

I have a known amount encoded in ecdhInfo. I can decrypt ecdhInfo according to this formula:

amount = 8 byte encrypted amount XOR first 8 bytes of keccak("amount" || Hs(8aR||i))

How can I get a decimal value out of this decrypted 64bit field? Or, what type of variable is it after decrypting? I am working in C and want to avoid floats.

  • "How can I get a decimal value out of this decrypted 64bit field?" <- The result is a decimal (base-10) value. Can you perhaps rephrase the question? – jtgrassie Dec 3 at 4:04
3

It is a 64 bit little endian unsigned integer.

If you're asking "how do I get a human amount out of an atomic unit number", divide by 1e12. cryptonote::print_money in the Monero source does this without using floating point operations (print the number, then manipulate the string).

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.