herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
450 stars 152 forks source link

How can i map 65Bytes (130 hexa chars) as a point on curve ? #112

Closed Henzi96 closed 3 years ago

Henzi96 commented 3 years ago

Lets say, that i recieved this data from the system, where the C implementation of MCL is running. 1B 04 32B 09179D6EB4E81E8E368CBD67F508877D6DE4EFF2202F3A3535490A25FCD9A999 32B 14972EA5853D7546D6A6D7A77FF584997D74E42AFF98DFDBB28D07F97AC2736E

How can i map this data as a point on curve in Java ? I noticed, that after execusion of this: G1 Q = new G1(), there are some random data, which looks like: this 1 4c21e376a683687523e4635c2ac9a2a0f264908f6ad06bb9dd784bb73650ba9 b52dd5ac97d74bd7cdd9dd3f3431248c3f4579a2bc9ec996c3daaf152abe4c9

herumi commented 3 years ago

that i recieved this data from the system, where the C implementation of MCL is running. 1B 04 32B 09179D6EB4E81E8E368CBD67F508877D6DE4EFF2202F3A3535490A25FCD9A999 32B 14972EA5853D7546D6A6D7A77FF584997D74E42AFF98DFDBB28D07F97AC2736E

What API did you use to get it?

The best way to move data among multi environments is to use serialize() and deserialize() method.

Henzi96 commented 3 years ago

Hm.. i think that i solved this problem. "04" is redundant. Remaining hexadecimal characters are representation of the point on the curve. There are 128 chars ( 64 Bytes ) ---> X...32Bytes, Y.....32Bytes

herumi commented 3 years ago

"04" is redundant.

It shows Jacobi coordinate. https://github.com/herumi/mcl/blob/master/api.md#get-string

Henzi96 commented 3 years ago

Yes, but in this case, "04" means something else as the second developer says. Its because of MultOS compatibility.