Skip to content

Instantly share code, notes, and snippets.

MD5 Collision with CRC32 Preimage

Here's the scenario: We want to craft two different messages with the same MD5 hash, and a specific CRC32 checksum, simultaneously.

In other words, we want an MD5 collision attack and a CRC32 preimage attack.

This might seem like a contrived scenario, but it's exactly the one I faced while producing my PNG hashquine (Yes OK maybe that's also a contrived scenario, cut me some slack).

On its own, a CRC32 preimage attack is trivial. You can craft a 4-byte suffix that gives any message a specific checksum, calculated using a closed-form expression (which I am too lazy to derive, not even with assistance from Z3). It's not an attack per-se, since CRC32 was never meant to be cryptograpically secure in the first place.

@TimelessP
TimelessP / editquill.py
Last active February 5, 2022 19:30
editquill - a super-minimal, line-mode, sandboxed text editor utility
#!/usr/bin/env python3
"""
editquill - a super-minimal, line-mode, sandboxed text editor utility
created by @TimelessP, 2022-02-05
MIT licence
https://gist.github.com/TimelessP/c6b0c20b314f6213ced329286fa6d4bf
"""
import copy
import datetime
@TimelessP
TimelessP / minimalmenu2.py
Last active November 13, 2021 13:09
minimalmenu2.py is more productive
"""
minimalmenu2.py by https://gist.github.com/TimelessP
(MIT Licence)
The primary requirement for minimalmenu2.py is to make it quick and easy to add new menu items.
Example usage:
```python
from minimalmenu2 import register_menu_action, menu