From 09ad4f5900f90230577413d716969087bf30478e Mon Sep 17 00:00:00 2001 From: sowle Date: Tue, 27 Apr 2021 05:52:55 +0300 Subject: [PATCH] crypto-sugar made less dependent of epee --- src/crypto/crypto-sugar.cpp | 2 +- src/crypto/crypto-sugar.h | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/crypto/crypto-sugar.cpp b/src/crypto/crypto-sugar.cpp index 0e923359..4774e9b7 100644 --- a/src/crypto/crypto-sugar.cpp +++ b/src/crypto/crypto-sugar.cpp @@ -18,7 +18,7 @@ namespace crypto const scalar_t c_scalar_P = { 0xffffffffffffffed, 0xffffffffffffffff, 0xffffffffffffffff, 0x7fffffffffffffff }; const scalar_t c_scalar_Pm1 = { 0xffffffffffffffec, 0xffffffffffffffff, 0xffffffffffffffff, 0x7fffffffffffffff }; const scalar_t c_scalar_256m1 = { 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff }; - const scalar_t c_scalar_1div8 = { 0x6106e529e2dc2f79, 0x7d39db37d1cdad0, 0x0, 0x600000000000000 }; + const scalar_t c_scalar_1div8 = { 0x6106e529e2dc2f79, 0x07d39db37d1cdad0, 0x0, 0x0600000000000000 }; const point_t c_point_H = { 0x05087c1f5b9b32d6, 0x00547595f445c3b5, 0x764df64578552f2a, 0x8a49a651e0e0da45 }; // == Hp(G), this is being checked in bpp_basics const point_t c_point_0 = point_t(point_t::tag_zero()); diff --git a/src/crypto/crypto-sugar.h b/src/crypto/crypto-sugar.h index 4752d81b..a064af19 100644 --- a/src/crypto/crypto-sugar.h +++ b/src/crypto/crypto-sugar.h @@ -8,7 +8,6 @@ #include #include #include "crypto.h" -#include "epee/include/string_tools.h" namespace crypto { @@ -130,8 +129,6 @@ namespace crypto return t_pod; } - - // // scalar_t - holds a 256-bit scalar, normally in [0..L-1] // @@ -407,7 +404,7 @@ namespace crypto std::string to_string_as_secret_key() const { - return epee::string_tools::pod_to_hex(*this); + return pod_to_hex(*this); } template @@ -501,7 +498,7 @@ namespace crypto bool from_string(const std::string& str) { crypto::public_key pk; - if (!epee::string_tools::parse_tpod_from_hex_string(str, pk)) + if (!parse_tpod_from_hex_string(str, pk)) return false; return from_public_key(pk); } @@ -634,19 +631,19 @@ namespace crypto friend std::ostream& operator<<(std::ostream& ss, const point_t &v) { crypto::public_key pk = v.to_public_key(); - return ss << epee::string_tools::pod_to_hex(pk); + return ss << pod_to_hex(pk); } operator std::string() const { crypto::public_key pk = to_public_key(); - return epee::string_tools::pod_to_hex(pk); + return pod_to_hex(pk); } std::string to_string() const { crypto::public_key pk = to_public_key(); - return epee::string_tools::pod_to_hex(pk); + return pod_to_hex(pk); } std::string to_hex_comma_separated_bytes_str() const