Expand description
Contains small utility functions used in the other hopr-crypto-...
crates
Structs§
- Secret
Value - Represents a secret value of a fixed length that is zeroized on drop. Secret values are always compared in constant time. The default value is all zeroes.
Functions§
- k256_
scalar_ from_ bytes - Creates secp256k1 secret scalar from the given bytes. Note that this function allows zero scalars.
- sample_
secp256k1_ field_ element - Sample a random secp256k1 field element that can represent a valid secp256k1 point.
The implementation uses the
hash_to_field
function as defined in<https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-13.html#name-hashing-to-a-finite-field>
Thesecret
must be at leastSecretKey::LENGTH
long. Thetag
parameter will be used as an additional Domain Separation Tag. - x25519_
scalar_ from_ bytes - Creates X25519 secret scalar (also compatible with Ed25519 scalar) from the given bytes. This function ensures the value is pre-multiplied by the curve’s co-factor and already reduced mod 2^255-19.