Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elligator map/inverse-map seems wrong #2

Open
hyggy2019 opened this issue Feb 14, 2023 · 0 comments
Open

Elligator map/inverse-map seems wrong #2

hyggy2019 opened this issue Feb 14, 2023 · 0 comments

Comments

@hyggy2019
Copy link

hyggy2019 commented Feb 14, 2023

Hi, there,
I've tested Elligator map/inverse-map with the code below. pk should be equal to pk2, however they often get different. Any help?

int Elligator_Test(){
std::cout << "Elligator_Test\n";
unsigned char pk[crypto_core_ristretto255_BYTES] = {};
unsigned char pk2[crypto_core_ristretto255_BYTES] = {};
unsigned char representative[crypto_core_ristretto255_BYTES] = {};
unsigned char* a = new unsigned char[crypto_core_ristretto255_SCALARBYTES];
bool success;
do {
crypto_core_ristretto255_scalar_random(a);
success = ScalarBaseMult2(pk, representative, a);
//ristretto_ropoGroup2Field(g_sum, buffs, mfe25519_one);
} while (!success);
std::cout << " pk = " << toBlock(pk) << " " << toBlock(pk + sizeof(block)) << "\n";
std::cout << " representative= " << toBlock(representative) << " " << toBlock(representative + sizeof(block)) << "\n";
std::cout << " a = " << toBlock(a) << " " << toBlock(a + sizeof(block)) << "\n";
RepresentativeToPublicKey2(pk2, representative);
std::cout << " After RepresentativeToPublicKey2, pk = " << toBlock(pk2) << " " << toBlock(pk2 + sizeof(block)) << "\n";
return 0;
}

@hyggy2019 hyggy2019 changed the title Elligator map/Reverse-map seems wrong Elligator map/inverse-map seems wrong Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant