aboutsummaryrefslogtreecommitdiff
path: root/types/util.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-05-31 23:56:49 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-05-31 23:56:49 +0200
commit1ac7f1bad7596bc0cc489d85de8bdf5d195b99a3 (patch)
tree4cea78430493f8819abb70efc71262407a860ce7 /types/util.go
parent4a9eddf4d45391c060a67f4464e4c0136aeaad21 (diff)
added types and fixed an error
- The wrong signature header was used for leaves - Added SigIdent marshalling - Added a wrapper that uses the log's hash function
Diffstat (limited to 'types/util.go')
-rw-r--r--types/util.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/types/util.go b/types/util.go
new file mode 100644
index 0000000..dc8ccba
--- /dev/null
+++ b/types/util.go
@@ -0,0 +1,13 @@
+package types
+
+import (
+ "crypto/sha256"
+)
+
+func Hash(buf []byte) *[HashSize]byte {
+ var ret [HashSize]byte
+ hash := sha256.New()
+ hash.Write(buf)
+ copy(ret[:], hash.Sum(nil))
+ return &ret
+}