Skip to content

Commit

Permalink
add comment to explain the MapToCurve algo we use (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
samlaf authored Apr 29, 2024
1 parent 46fd7b1 commit 03574d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crypto/bn254/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ func VerifySig(sig *bn254.G1Affine, pubkey *bn254.G2Affine, msgBytes [32]byte) (

}

// TODO: which algorithm is this implementing?
//
// add details...
// MapToCurve implements the simple hash-and-check (also sometimes try-and-increment) algorithm
// see https://hackmd.io/@benjaminion/bls12-381#Hash-and-check
// Note that this function needs to be the same as the one used in the contract:
// https://github.com/Layr-Labs/eigenlayer-middleware/blob/1feb6ae7e12f33ce8eefb361edb69ee26c118b5d/src/libraries/BN254.sol#L292
// we don't use the newer constant time hash-to-curve algorithms as they are gas-expensive to compute onchain
func MapToCurve(digest [32]byte) *bn254.G1Affine {

one := new(big.Int).SetUint64(1)
Expand Down

0 comments on commit 03574d1

Please sign in to comment.