-
Notifications
You must be signed in to change notification settings - Fork 0
/
groestl.go
69 lines (56 loc) · 1.37 KB
/
groestl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package groestl
import (
"hash"
)
// New224 returns a new hash.Hash computing the Groestl checksum
func New224() hash.Hash {
h, _ := New(224)
return h
}
// New256 returns a new hash.Hash computing the Groestl checksum
func New256() hash.Hash {
h, _ := New(256)
return h
}
// New384 returns a new hash.Hash computing the Groestl checksum
func New384() hash.Hash {
h, _ := New(384)
return h
}
// New512 returns a new hash.Hash computing the Groestl checksum
func New512() hash.Hash {
h, _ := New(512)
return h
}
// Sum224 returns the Groestl-224 checksum of the data.
func Sum224(data []byte) (sum224 [Size224]byte) {
h := New224()
h.Write(data)
sum := h.Sum(nil)
copy(sum224[:], sum[:Size224])
return
}
// Sum256 returns the Groestl-256 checksum of the data.
func Sum256(data []byte) (sum256 [Size256]byte) {
h := New256()
h.Write(data)
sum := h.Sum(nil)
copy(sum256[:], sum[:Size256])
return
}
// Sum384 returns the Groestl-384 checksum of the data.
func Sum384(data []byte) (sum384 [Size384]byte) {
h := New384()
h.Write(data)
sum := h.Sum(nil)
copy(sum384[:], sum[:Size384])
return
}
// Sum512 returns the Groestl-512 checksum of the data.
func Sum512(data []byte) (sum512 [Size512]byte) {
h := New512()
h.Write(data)
sum := h.Sum(nil)
copy(sum512[:], sum[:Size512])
return
}