Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Forcing a file's CRC to any value (2018) (nayuki.io)
15 points by jstrieb on Nov 23, 2021 | hide | past | favorite | 5 comments


Learning about CRCs was fun for me. I had to dig into the math to figure out how to calculate the 32 bit ethernet CRC for packets being sent across a 256 bit bus for a 10 Gbps NIC I implemented on a Xilinx KC705 a few years ago. I found this guide from 1993 quite informative: https://zlib.net/crc_v3.txt


Why would there not be any CRC library for an FPGA?


The purpose of the exercise was to improve my ability to develop functionality using Verilog. Using a library would have been too easy.


What would be really clever is if it could alter, say, source code or natural language prose of sufficient length to force a specific CRC preserving the semantics of the program/prose e.g. by reordering or changing words and/or identifiers. (changing 4 bytes to arbitrary values in a comment is against the spirit of this)


Here's a repo that does something a little more generic that you can adapt for that.

https://github.com/madler/spoof/

(you can naively use this to flip case where the case is not semantically important, but you can also extend this as needed)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: