Browse Source

better docs on Elligator

master
Michael Hamburg 10 years ago
parent
commit
d2ab89bdc5
2 changed files with 25 additions and 1 deletions
  1. +14
    -1
      include/decaf.h
  2. +11
    -0
      src/decaf.c

+ 14
- 1
include/decaf.h View File

@@ -192,12 +192,25 @@ decaf_bool_t decaf_valid (
* is indifferentiable from a random oracle.
*
* @param [in] hashed_data Output of some hash function.
* @param [out] pt The hashed input
* @param [out] pt The data hashed to the curve.
*/
void decaf_nonuniform_map_to_curve (
decaf_point_t pt,
const unsigned char hashed_data[DECAF_SER_BYTES]
) API_VIS NONNULL2;

/**
* @brief Indifferentiable hash function encoding to curve.
*
* Equivalent to calling decaf_nonuniform_map_to_curve twice and adding.
*
* @param [in] hashed_data Output of some hash function.
* @param [out] pt The data hashed to the curve.
*/
void decaf_uniform_map_to_curve (
decaf_point_t pt,
const unsigned char hashed_data[2*DECAF_SER_BYTES]
) API_VIS NONNULL2;
#undef API_VIS
#undef WARN_UNUSED


+ 11
- 0
src/decaf.c View File

@@ -414,6 +414,17 @@ void decaf_nonuniform_map_to_curve (
gf_mul(p->t,b,e);
}


void decaf_uniform_map_to_curve (
decaf_point_t pt,
const unsigned char hashed_data[2*DECAF_SER_BYTES]
) {
decaf_point_t pt2;
decaf_nonuniform_map_to_curve(pt,hashed_data);
decaf_nonuniform_map_to_curve(pt2,&hashed_data[DECAF_SER_BYTES]);
decaf_add(pt,pt,pt2);
}

decaf_bool_t decaf_valid (
const decaf_point_t p
) {


Loading…
Cancel
Save