diff options
author | Özgür Kesim <oec@codeblau.de> | 2024-04-09 19:21:24 +0200 |
---|---|---|
committer | Özgür Kesim <oec@codeblau.de> | 2024-04-09 19:21:24 +0200 |
commit | f28109fc32c9068cf57619ccd7ee05a8da8e5d24 (patch) | |
tree | 80e75d0be59f8fbdee8d1487c4cfb61bc1b0eae7 /nizk/nizk.go | |
parent | 03d3f676c36ccd36bb201d317bd2350ada6ba451 (diff) |
nizk: use Bytes interface for abstraction
Diffstat (limited to 'nizk/nizk.go')
-rw-r--r-- | nizk/nizk.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nizk/nizk.go b/nizk/nizk.go index 84e7db4..a8bdaae 100644 --- a/nizk/nizk.go +++ b/nizk/nizk.go @@ -15,9 +15,17 @@ var Curve = curve.Curve25519 var G = Curve.Generator() var One = Curve.ScalarOne() -func Challenge(points ...*Point) *Scalar { +type Bytes interface { + Bytes() []byte +} + +type Bites []byte + +func (b Bites) Bytes() []byte { return b } + +func Challenge(bs ...Bytes) *Scalar { h512 := sha512.New() - for _, p := range points { + for _, p := range bs { h512.Write(p.Bytes()) } ch, e := Curve.ScalarFromBytes(h512.Sum(nil)) |