Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
using Libz
println(string(Libz.crc32(UInt8.(b"The quick brown fox jumps over the lazy dog")), base=16))

View file

@ -0,0 +1,31 @@
function crc32(crc::Int, str::String)
table = zeros(UInt32, 256)
for i in 0:255
tmp = i
for j in 0:7
if tmp & 1 == 1
tmp >>= 1
tmp ⊻= 0xedb88320
else
tmp >>= 1
end
end
table[i + 1] = tmp
end
crc ⊻= 0xffffffff
for i in UInt32.(collect(str))
crc = (crc >> 8) ⊻ table[(crc & 0xff) ⊻ i + 1]
end
crc ⊻ 0xffffffff
end
str = "The quick brown fox jumps over the lazy dog"
crc = crc32(0, str)
assert(crc == 0x414fa339)
println("Message: ", str)
println("Checksum: ", hex(crc))