Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/CRC-32/Racket/crc-32.rkt
Normal file
15
Task/CRC-32/Racket/crc-32.rkt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#lang racket
|
||||
(define (bytes-crc32 data)
|
||||
(bitwise-xor
|
||||
(for/fold ([accum #xFFFFFFFF])
|
||||
([byte (in-bytes data)])
|
||||
(for/fold ([accum (bitwise-xor accum byte)])
|
||||
([num (in-range 0 8)])
|
||||
(bitwise-xor (quotient accum 2)
|
||||
(* #xEDB88320 (bitwise-and accum 1)))))
|
||||
#xFFFFFFFF))
|
||||
|
||||
(define (crc32 s)
|
||||
(bytes-crc32 (string->bytes/utf-8 s)))
|
||||
|
||||
(format "~x" (crc32 "The quick brown fox jumps over the lazy dog"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue