forked from lthn/blockchain
crypto: c_point_H_plus_G and c_point_H_minus_G constants added + unittest
This commit is contained in:
parent
185ccae95f
commit
5e0ce8cfb4
3 changed files with 13 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue