forked from lthn/blockchain
crypto: ge_bytes_hash_to_ec_32
This commit is contained in:
parent
670bacbf3f
commit
457b84fd7b
2 changed files with 12 additions and 6 deletions
|
|
@ -4323,23 +4323,28 @@ void ge_p2_to_p3(ge_p3 *r, const ge_p2 *t)
|
|||
|
||||
|
||||
/*
|
||||
In: ge_bytes -- points to 32 bytes of data
|
||||
Out: res = Hp(ge_bytes)
|
||||
where Hp = 8 * ge_fromfe_frombytes_vartime(cn_fast_hash(ge_bytes))
|
||||
In: data -- points to 'size' bytes of data
|
||||
Out: res = Hp(data)
|
||||
where Hp = 8 * ge_fromfe_frombytes_vartime(cn_fast_hash(data))
|
||||
*/
|
||||
void ge_bytes_hash_to_ec(ge_p3 *res, const unsigned char *ge_bytes)
|
||||
void ge_bytes_hash_to_ec(ge_p3 *res, const void *data, size_t size)
|
||||
{
|
||||
unsigned char h[HASH_SIZE];
|
||||
ge_p2 point;
|
||||
ge_p1p1 point2;
|
||||
|
||||
cn_fast_hash(ge_bytes, 32, (char*)h);
|
||||
cn_fast_hash(data, size, (char*)h);
|
||||
ge_fromfe_frombytes_vartime(&point, &h[0]);
|
||||
/*ge_p2_to_p3(res, &point); -- can be used to avoid multiplication by 8 for debugging */
|
||||
ge_mul8(&point2, &point);
|
||||
ge_p1p1_to_p3(res, &point2);
|
||||
}
|
||||
|
||||
void ge_bytes_hash_to_ec_32(ge_p3 *res, const unsigned char *ge_bytes)
|
||||
{
|
||||
ge_bytes_hash_to_ec(res, ge_bytes, 32);
|
||||
}
|
||||
|
||||
void ge_mul8_p3(ge_p3 *r, const ge_p3 *t)
|
||||
{
|
||||
ge_p1p1 p1;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@ void ge_mul8(ge_p1p1 *, const ge_p2 *);
|
|||
void ge_mul8_p3(ge_p3 *, const ge_p3 *);
|
||||
void ge_fromfe_frombytes_vartime(ge_p2 *, const unsigned char *);
|
||||
void ge_p2_to_p3(ge_p3 *r, const ge_p2 *t);
|
||||
void ge_bytes_hash_to_ec(ge_p3 *, const unsigned char *);
|
||||
void ge_bytes_hash_to_ec(ge_p3 *, const void *, size_t);
|
||||
void ge_bytes_hash_to_ec_32(ge_p3 *, const unsigned char *);
|
||||
|
||||
void ge_p3_0(ge_p3 *h);
|
||||
void ge_sub(ge_p1p1 *, const ge_p3 *, const ge_cached *);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue