0

Example:

Input key = 0x025f37d20e5b18909361e0ead7ed17c69b417bee70746c9e9c2bcb1394d921d4ae

Output address = 0xd09D3103CcABfb769eDc3e9B01500Ca7241D470A

I have been using an algorithm from keccak-tiny.c by David Leon Gil, with the following change:

Padding with 0x01 instead of 0x06: 7 bytes of message "testing" give me 5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02 as is in "Which cryptographic hash function does Ethereum use?"

In "Generating an address from a public key" is algorithm, but I have questions:

  • how exactly means getPublic,keyFromPublic ?
  • before keccak I must convert from a 33-byte key to a 65-byte key (address will be compact-independent) or keccak is applied on hex string text form, not bytes?
  • how checksum address with upper/lower case?

How to do it with C++?

1

Is solved: as is in"How are ethereum addresses generated?" we have 4 steps:

1. convert to 65 byte uncompressed key
2. removed first "04" byte, we have 5f37d20e5b18909361e0ead7ed17c69b417bee70746c9e9c2bcb1394d921d4ae612d83e3487012034792ff36357ee25f382913cfeb54a8622b7ef35d635d8740 for 0x025f37d20e5b18909361e0ead7ed17c69b417bee70746c9e9c2bcb1394d921d4ae
3. Keccak this 64 bytes to 32 bytes: 81862025a6a8b333133c9b9ad09d3103ccabfb769edc3e9b01500ca7241d470a
4. Get last 20 bytes: 0xd09D3103CcABfb769eDc3e9B01500Ca7241D470A
| improve this answer | |

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.