blob: 826670647b1a5ad180b037143b688858fe22c16a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package btrfs
import (
"encoding/binary"
"fmt"
"hash/crc32"
)
type CSum [0x20]byte
func (csum CSum) String() string {
return fmt.Sprintf("%x", csum)
}
func CRC32c(data []byte) CSum {
crc := crc32.Update(0, crc32.MakeTable(crc32.Castagnoli), data)
var ret CSum
binary.LittleEndian.PutUint32(ret[:], crc)
return ret
}
|