https://github.com/bodgit/crc32
Golang library to manipulate CRC-32 checksum values
https://github.com/bodgit/crc32
crc crc-calculation crc32 golang golang-library
Last synced: 6 months ago
JSON representation
Golang library to manipulate CRC-32 checksum values
- Host: GitHub
- URL: https://github.com/bodgit/crc32
- Owner: bodgit
- License: bsd-3-clause
- Created: 2020-08-25T22:42:37.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-07T20:00:12.000Z (over 1 year ago)
- Last Synced: 2025-02-13T02:18:17.438Z (8 months ago)
- Topics: crc, crc-calculation, crc32, golang, golang-library
- Language: Go
- Homepage: https://godoc.org/github.com/bodgit/crc32
- Size: 22.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bodgit/crc32/releases)
[](https://github.com/bodgit/crc32/actions?query=workflow%3ABuild)
[](https://coveralls.io/github/bodgit/crc32?branch=main)
[](https://goreportcard.com/report/github.com/bodgit/crc32)
[](https://godoc.org/github.com/bodgit/crc32)

crc32
=====An implementation of an algorithm to modify a file so that its CRC-32 checksum
matches a given value. This requires four sacrificial bytes in the file that
will be modified to generate the desired value. A small example:
```golang
f, err := os.OpenFile("somefile", O_RDWR, 0) // Remember to open read/write!
if err != nil {
log.Fatal(err)
}
defer f.Close()if err := crc32.ForceCRC32(f, 0, 0xdeadbeef); err != nil {
log.Fatal(err)
}
```
In this example the first four bytes in `somefile` will be modified so that
the CRC-32 checksum of `somefile` will be `0xdeadbeef` however the bytes can
be anywhere in the file, but must be contiguous.