github.com/cloudflare/circl@v1.5.0/group/hash.go (about) 1 package group 2 3 import ( 4 "math/big" 5 6 "github.com/cloudflare/circl/expander" 7 ) 8 9 // HashToField generates a set of elements {u1,..., uN} = Hash(b) where each 10 // u in GF(p) and L is the security parameter. 11 func HashToField(u []big.Int, b []byte, e expander.Expander, p *big.Int, L uint) { 12 count := uint(len(u)) 13 bytes := e.Expand(b, count*L) 14 for i := range u { 15 j := uint(i) * L 16 u[i].Mod(u[i].SetBytes(bytes[j:j+L]), p) 17 } 18 }