crypto: ed25519 -> Wei conversion

This commit is contained in:
j-berman
2026-07-08 06:34:40 -07:00
parent 2b49cebbcb
commit b61c750029
9 changed files with 408 additions and 6 deletions
+14
View File
@@ -39,6 +39,7 @@
#include "crypto/crypto.h"
#include "crypto/hash.h"
#include "crypto-tests.h"
#include "fcmp_pp/fcmp_pp_crypto.cpp"
#include "../io.h"
using namespace std;
@@ -53,6 +54,9 @@ bool operator !=(const key_derivation &a, const key_derivation &b) {
return 0 != memcmp(&a, &b, sizeof(key_derivation));
}
bool operator !=(const ec_coord &a, const ec_coord &b) {
return 0 != memcmp(&a, &b, sizeof(ec_coord));
}
DISABLE_GCC_WARNING(maybe-uninitialized)
int main(int argc, char *argv[]) {
@@ -273,6 +277,16 @@ int main(int argc, char *argv[]) {
if (expected != actual) {
goto error;
}
} else if (cmd == "point_to_wei_x_y") {
crypto::ec_point point;
crypto::ec_coord expected_wei_x, expected_wei_y, actual_wei_x, actual_wei_y;
get(input, point, expected_wei_x, expected_wei_y);
if (!fcmp_pp::point_to_wei_x_y(point, actual_wei_x, actual_wei_y)) {
goto error;
}
if (expected_wei_x != actual_wei_x || expected_wei_y != actual_wei_y) {
goto error;
}
} else {
throw ios_base::failure("Unknown function: " + cmd);
}