-
Notifications
You must be signed in to change notification settings - Fork 0
/
sha3.go
79 lines (55 loc) · 1.19 KB
/
sha3.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
70
71
72
73
74
75
76
77
78
79
package hash
import (
"golang.org/x/crypto/sha3"
)
// SHA3_224 哈希值
func (this Hash) SHA3_224() Hash {
h := sha3.New224()
h.Write(this.data)
this.data = h.Sum(nil)
return this
}
// NewSHA3_224
func (this Hash) NewSHA3_224() Hash {
this.hash = sha3.New224()
return this
}
// ============================================
// SHA3_256 哈希值
func (this Hash) SHA3_256() Hash {
h := sha3.New256()
h.Write(this.data)
this.data = h.Sum(nil)
return this
}
// NewSHA3_256
func (this Hash) NewSHA3_256() Hash {
this.hash = sha3.New256()
return this
}
// ============================================
// SHA3_384 哈希值
func (this Hash) SHA3_384() Hash {
h := sha3.New384()
h.Write(this.data)
this.data = h.Sum(nil)
return this
}
// NewSHA3_384
func (this Hash) NewSHA3_384() Hash {
this.hash = sha3.New384()
return this
}
// ============================================
// SHA3_512 哈希值
func (this Hash) SHA3_512() Hash {
h := sha3.New512()
h.Write(this.data)
this.data = h.Sum(nil)
return this
}
// NewSHA3_512
func (this Hash) NewSHA3_512() Hash {
this.hash = sha3.New512()
return this
}