sharplispers / ironclad

A cryptographic toolkit written in Common Lisp
BSD 3-Clause "New" or "Revised" License
166 stars 28 forks source link

CRC32C #67

Closed Devon7 closed 7 months ago

Devon7 commented 7 months ago

It seems CRC32C aka Castagnoli aka CRC-32/ISCSI is not supported, correct?

glv2 commented 7 months ago

Correct. Currently only CRC32 (with polynomial 0x04C11DB7) is implemented. CRC32C (with polynomial 0x1EDC6F41) is not. Do you need it? (I guess adding it wouldn't take too long).

glv2 commented 7 months ago

CRC32C added in cd67e7b606acd2d14ed854f7f10b6955a68ceec4

Devon7 commented 7 months ago

Thanks! So quick. I might add Mark Adler's code to ironclad/src/opt/ccl/x86oid-vm.lisp as, say, ironclad::%crc32c-inner-loop for speed. A 2.2 GHz Intel Core i7 operating on 10 GiB of zeros in memory runs this fast:

GB/s    command
4.0 dd if=/dev/zero bs=1073741824 count=1 | time crc32c 10  # C with 3-stage-pipelined hardware
0.72    dd if=/dev/zero bs=1073741824 count=1 | time crc32c -10 # C with no assembler
0.064   (time (ironclad:digest-sequence :crc32c *10-GiB-of-zeros*)) ; CCL 1.12.1