Skip to content

Instantly share code, notes, and snippets.

@TimelessP
TimelessP / parallax.py
Last active August 3, 2025 10:01
Motion parallax masking using rotating random field layers mapped to shades of grey.
#!/usr/bin/env python3
"""
Parallax Motion Masking Video Generator
Creates videos where an image is only visible through the differential motion
of random noise layers at different speeds based on the image's grey levels.
"""
import numpy as np
import cv2

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