crc32

CRC32, 2 proc, copied from RosettaCode.

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Passing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install crc32
choosenim install crc32
git clone https://github.com/juancarlospaco/nim-crc32

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
crc32 - - - - - - -

Source

Repository https://github.com/juancarlospaco/nim-crc32
Homepage https://github.com/juancarlospaco/nim-crc32
Documentation View Documentation
Registry Source nimble_official

README

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

:star: @juancarlospaco
:star: @adokitkat
:star: @elcritch
:star: @hamidb80
:star: @amit-gshe
:star: @Seanld
:star: @rebase
:star: @Tayzonxperia
:star: @gustavo-veiga