1
0
Fork 0
forked from lthn/blockchain

crypto: c_point_H_plus_G and c_point_H_minus_G constants added + unittest

This commit is contained in:
sowle 2022-10-10 23:47:49 +02:00
parent 185ccae95f
commit 5e0ce8cfb4
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 13 additions and 0 deletions

View file

@ -28,6 +28,9 @@ namespace crypto
const point_t c_point_0 = point_t(point_t::tag_zero());
const point_t c_point_H_plus_G = c_point_H + c_point_G; // checked in crypto_constants
const point_t c_point_H_minus_G = c_point_H - c_point_G; // checked in crypto_constants
static_assert(sizeof(scalar_t::m_sk) == sizeof(scalar_t::m_u64) && sizeof(scalar_t::m_u64) == sizeof(scalar_t::m_s), "size missmatch");
} // namespace crypto

View file

@ -917,6 +917,8 @@ namespace crypto
extern const point_t c_point_H2;
extern const point_t c_point_X;
extern const point_t c_point_0;
extern const point_t c_point_H_plus_G;
extern const point_t c_point_H_minus_G;
//
// hash functions' helper

View file

@ -1118,6 +1118,14 @@ TEST(crypto, scalar_arithmetic_assignment)
return true;
}
TEST(crypto, constants)
{
ASSERT_EQ(c_point_H_plus_G, c_point_H + c_point_G);
ASSERT_EQ(c_point_H_minus_G, c_point_H - c_point_G);
return true;
}
TEST(crypto, point_basics)
{
scalar_t s = 4;