No description
Find a file
2025-12-29 13:33:39 +00:00
.github Create add-stars.yml 2022-02-16 15:42:05 -08:00
src take major Nim version into account 2021-12-19 12:17:11 +01:00
.gitignore Initial commit 2018-05-05 21:03:49 -03:00
crc32.nimble Update crc32.nimble 2021-12-19 14:21:56 -08:00
README.md Regenerate build artifacts. 2025-12-29 13:33:39 +00:00

CRC32

CRC32 for Nim, 2 proc. Its just a proc so no much to document about it, just pass the thingy you want to do CRC.

  • Works with --gc:arc, --gc:orc, --panics:on, --experimental:strictFuncs, C, C++, JavaScript.
  • Uses system.nim only, does not import anything from stdlib. Works in-place, can out-place using sugar.dup.

Use

from std/sugar import dup  # Optional, to out-place.

var x = "The quick brown fox jumps over the lazy dog."
crc32(x)  ## In-Place.
doAssert x == "519025E9"
doAssert "The quick brown fox jumps over the lazy dog.".dup(crc32) == "519025E9"  ## Out-Place.

var e = " "
crc32(e)  ## In-Place.
doAssert e == "E96CCF45"
doAssert " ".dup(crc32) == "E96CCF45"  ## Out-Place.

var z = ""
crc32(z)   ## In-Place.
doAssert z == "00000000"
doAssert "".dup(crc32) == "00000000"  ## Out-Place.

var f = "crc32.nim"
crc32FromFile(f)  ## In-Place.
echo f
echo "crc32.nim".dup(crc32FromFile)  ## Out-Place.

Install

nimble install crc32

Stars

@juancarlospaco @adokitkat @elcritch @hamidb80 @amit-gshe @Seanld @rebase @Tayzonxperia