-
Hi libsodium team, I'm searching for an Elligator2 implementation compatible with the hash-to-curve RFC draft: From your documentation, I could not find any details about the Elligator2 implementation in libsodium. I created a sample application to compare the result from libsodium with the test-vectors form the RFC. Sample application: #include <sodium.h>
#include <stdio.h>
int main() {
size_t bin_len;
char in_hex[] = "7f3e7fb9428103ad7f52db32f9df32505d7b427d894c5093f7a0f0374a30641d";
uint8_t in_bin[32];
uint8_t p[32];
char p_hex[32*2+1];
sodium_hex2bin(in_bin, sizeof(in_bin), in_hex, 32*2, NULL, &bin_len, NULL);
crypto_core_ed25519_from_uniform(p, in_bin);
sodium_bin2hex(p_hex, sizeof(p_hex), p, sizeof(p));
printf("in : %s\n", in_hex);
printf("out: %s\n", p_hex);
return 0;
} test-vector from RFC:
From my understanding,
This leads me to the following questions: Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The hash-to-curve map is accessible via the following functions, but only in the
|
Beta Was this translation helpful? Give feedback.
The hash-to-curve map is accessible via the following functions, but only in the
master
branch:crypto_core_ed25519_from_string()
(_NU)crypto_core_ed25519_from_string_ro()
(_RO)crypto_core_ristretto255_from_string()
(_NU)crypto_core_ristretto255_from_string_ro()
(_RO)from_string*()
andfrom_uniform()
both use Elligator, but handle the sign differently. Infrom_uniform()
the top bit of the string represents the sign of the X coordinate.