1
0
Fork 0
forked from lthn/blockchain

crypto-sugar made less dependent of epee

This commit is contained in:
sowle 2021-04-27 05:52:55 +03:00
parent 191a89f9c8
commit 09ad4f5900
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
2 changed files with 6 additions and 9 deletions

View file

@ -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());

View file

@ -8,7 +8,6 @@
#include <string>
#include <boost/multiprecision/cpp_int.hpp>
#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<typename MP_type>
@ -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