Skip to content

Hash to field with custom hash function #271

@bellebaum

Description

@bellebaum

Hi,

I am trying to use this library to implement BBS Signatures and Proofs as well as various extensions. To do this, I need a hash-to-curve with a bit of flexibility in the hashing-part. Specifically, I need to be able to exchange the hash function. Ideally, I would also be able to use incremental hash APIs.

I understand that my own expand_message and this library's blst_map_to_g1 will get me most of the way there. What is missing is the option to construct field elements (fp) from byte strings (by interpretation as big endian and calculation mod p). Essentially the following functionality:

blst/src/hash_to_field.c

Lines 145 to 151 in 097818a

limbs_from_be_bytes(elem, bytes, L);
bytes += L;
/*
* L-bytes block % P, output is in Montgomery domain...
*/
redc_mont_384(elems[0], elem, BLS12_381_P, p0);
mul_mont_384(elems[0], elems[0], BLS12_381_RRRR, BLS12_381_P, p0);

Would it be possible to add this to the public API? Say as a function void blst_fp_from_be_bytes(blst_fp *out, const byte *in, size_t len)?

Thanks in advance :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions