github.com/dusk-network/dusk-crypto@v0.1.3/rangeproof/fiatshamir/fiatshamir.go (about) 1 package fiatshamir 2 3 import ristretto "github.com/bwesterb/go-ristretto" 4 5 // HashCacher will be used for the Fiat-Shamir 6 // transform and will cache the necesarry values of the transcript 7 type HashCacher struct { 8 Cache []byte 9 } 10 11 // Append will add a new value to the current cache 12 func (h *HashCacher) Append(vals ...[]byte) { 13 14 for _, x := range vals { 15 h.Cache = append(h.Cache, x...) 16 } 17 } 18 19 // Result will return the current byte slice in 20 // the cache 21 func (h *HashCacher) Result() []byte { 22 return h.Cache 23 } 24 25 // Clear will clear the current cache 26 func (h *HashCacher) Clear() { 27 h.Cache = []byte{} 28 } 29 30 // Derive will turn the data in the cache 31 // into a point on the ristretto curve 32 func (h *HashCacher) Derive() ristretto.Scalar { 33 var s ristretto.Scalar 34 s.Derive(h.Cache) 35 return s 36 }