summaryrefslogtreecommitdiff
path: root/pkg/btrfs/crc32c.go
blob: 4ea4169524cc230fed5910d4fdff72fa27cbbc0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package btrfs

import (
	"encoding/binary"
	"hash/crc32"
)

type CSum [0x20]byte

func CRC32c(data []byte) CSum {
	crc := crc32.Update(0, crc32.MakeTable(crc32.Castagnoli), data)

	var ret CSum
	binary.LittleEndian.PutUint32(ret[:], crc)
	return ret
}