dusk-network / bls12_381

Implementation of the BLS12-381 pairing-friendly elliptic curve group with extra features needed by the Dusk-Network team
Other
19 stars 20 forks source link

Add `from_var_bytes` to `Scalar` #133

Closed artifex11 closed 9 months ago

artifex11 commented 9 months ago

Summary

A function that will take arbitrary slices, hash with BLAKE2b into 256-bit numbers, and perform a modulus multiplication to produce valid scalars.

fn from_var_bytes(bytes: &[u8]) -> Scalar

Possible solution design or implementation

Such functionality is required for downstream protocols such as Phoenix or Rusk contract ID computation. They produce arbitrary bytes, being either asymmetric key exchange protocols or network transaction payload, annd perform off-circuit field operations with such inputs.