hash-to-curve: bls examples

This commit is contained in:
Paul Miller 2023-02-14 23:08:38 +00:00
parent b81d74d3cb
commit b1f50d9364
No known key found for this signature in database
GPG Key ID: 697079DA6878B89B

@ -473,8 +473,11 @@ Every curve has exported `hashToCurve` and `encodeToCurve` methods:
import { hashToCurve, encodeToCurve } from '@noble/curves/secp256k1';
import { randomBytes } from '@noble/hashes/utils';
console.log(hashToCurve(randomBytes()));
console.log(hashToCurve(randomBytes(), { DST: 'custom' }));
console.log(encodeToCurve(randomBytes()));
import { bls12_381 } from '@noble/curves/bls12-381';
bls12_381.G1.hashToCurve(randomBytes(), { DST: 'another' });
bls12_381.G2.hashToCurve(randomBytes(), { DST: 'custom' });
```
If you need low-level methods from spec: