herumi / bls

288 stars 132 forks source link

SetLittleEndian vs SetLittleEndianMod #71

Closed themantre closed 3 years ago

themantre commented 3 years ago

Thanks for your amazing library.

May I know what exactly SetLittleEndianMod is doing? A secret key is 32 bytes and SetLittleEndian just simply put any 32 bytes as secret key. right? But SetLittleEndianMod is doing some kind of bitwise operations. What is the different between these two methods? Is it safe to use 256-bits bip-39 seed as an input and generate unique secret key?

herumi commented 3 years ago

SetLittleEndianMod accepts max 512-bit little endian integer x and set x mod p. 32-bytes integer may be larger than p, then modulo is necessary. The details of those APIs here. https://github.com/herumi/mcl/blob/master/api.md#set-buf0bufsize-1-to-x-with-masking-according-to-the-following-way