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.

1
  • "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
    Commented Dec 3, 2019 at 4:04

1 Answer 1

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).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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