Skip to content

Commit

Permalink
chore: Add HashPointToBytes method (#428)
Browse files Browse the repository at this point in the history
* mod: rename module to new location (#426)

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* Add `MapToScalarFieldBytes` which allows us to map a point to 32 bytes using MapToScalarField

* rename method to `HashPointToBytes`

---------

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
  • Loading branch information
kevaundray committed Feb 29, 2024
1 parent f8289fc commit a519cc4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ipa.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ func FromBytes(fr *Fr, data []byte) {
copy(aligned[32-len(data):], data)
fr.SetBytes(aligned[:])
}

func HashPointToBytes(point *Point) [32]byte {
var hashedPoint Fr
point.MapToScalarField(&hashedPoint)
return hashedPoint.BytesLE()
}

0 comments on commit a519cc4

Please sign in to comment.