develop
trivernis 5 years ago
parent 6f1aaff9aa
commit c8fbb62f07

@ -114,13 +114,13 @@ func createChunk(data []byte, name string) ChunkData {
rawLength := make([]byte, 4)
binary.BigEndian.PutUint32(rawLength, uint32(len(data)))
rawName := []byte(name)
dataAndName := make([]byte, 0) // len(rawName) + len(data)
dataAndName := make([]byte, 0)
dataAndName = append(dataAndName, rawName...)
dataAndName = append(dataAndName, data...)
crc := crc32.ChecksumIEEE(dataAndName)
rawCrc := make([]byte, 4)
binary.BigEndian.PutUint32(rawCrc, crc)
fullData := make([]byte, 0) // len(rawLength) + len(dataAndName) + 4
fullData := make([]byte, 0)
fullData = append(fullData, rawLength...)
fullData = append(fullData, dataAndName...)
fullData = append(fullData, rawCrc...)

Loading…
Cancel
Save