-
Notifications
You must be signed in to change notification settings - Fork 0
/
crc64.go
49 lines (33 loc) · 761 Bytes
/
crc64.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
package hash
import (
"hash/crc64"
)
// CRC64ISO
func (this Hash) CRC64_ISO() Hash {
tab := crc64.MakeTable(crc64.ISO)
h := crc64.New(tab)
h.Write(this.data)
this.data = h.Sum(nil)
return this
}
// NewCRC64_ISO
func (this Hash) NewCRC64_ISO() Hash {
tab := crc64.MakeTable(crc64.ISO)
this.hash = crc64.New(tab)
return this
}
// ============================================
// CRC64ECMA 哈希值
func (this Hash) CRC64_ECMA() Hash {
tab := crc64.MakeTable(crc64.ECMA)
h := crc64.New(tab)
h.Write(this.data)
this.data = h.Sum(nil)
return this
}
// NewCRC64_ECMA
func (this Hash) NewCRC64_ECMA() Hash {
tab := crc64.MakeTable(crc64.ECMA)
this.hash = crc64.New(tab)
return this
}