mirror of
https://github.com/monero-project/monero.git
synced 2026-07-28 14:47:15 -07:00
crypto: ed25519 -> Wei conversion
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user