Skip to content

Seems the public key generated by "generate_pubkey" not match the giving source address? #1

@crackerli

Description

@crackerli

Test platform:
Android NDK arm64v8
And
Mac 10.15.7, gcc Apple clang version 12.0.0 (clang-1200.0.32.27)

Produce steps:

  1. find the demo private key: Scalar priv_key = { 0xca14d6eed923f6e3, 0x61185a1b5e29e6b2, 0xe26d38de9c30753b, 0x3fdf0efb0a5714 }; and its address: char* source_str = "B62qiy32p8kAKnny8ZFwoMhYpBppM1DWVCqAPBYNcXnsAHhnfAAuXgg";

  2. Decode the address string with base58 decoder, and get the following byte stream:
    cb 01 01 0f 48 c6 5b d2 5f 85 f3 e4 ea 4e fe be b7 5b 79 7b d7 43 60 3b e0 4b 4e ad 84 56 98 b7 6b d3 31 00 82 7b 2d 85

remove first 3 bytes those indicate version and end five bytes of parity and checksum, then the byte stream of x coordinate of public key should be: 0f 48 c6 5b d2 5f 85 f3 e4 ea 4e fe be b7 5b 79 7b d7 43 60 3b e0 4b 4e ad 84 56 98 b7 6b d3 31.

  1. call "generate_pubkey" with param "priv_key", and get the public key data stored in Affine structure, and print any array item of Field x, for example, I do printf("{ pubkey_x: '%x',\n", (kp.pub.x)[0]); , the result is "d86d9a3b"(we can forget the data losing of convert from uint64_t to uint32_t), but I can not find any of the byte value in the byte stream I produced in step 2.

What's wrong here?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions