Finally, a tool optimized for creating Git commit hash collisions
> Hash as int
Should be "Hash as decimal". The hexadecimal hash is already the same integer.
> Message: "Fix critical bug" + git-prime Nonce: 167
In the actual code it looks like:
Fix critical bug
git-prime Nonce: 167
So it is like a trailer. However, can trailer names have spaces in them?A more conservative choices for the trailer header seems wiser, like:
Prime-nonce: N
would be a safer choice for the trailer. (The word "git" is not required; we know we are in Git.)Another subtlety is that if the message already has trailers, then you don't need to separate that from them by a blank line
Git has a command for manipulating trailers; that could be used.
(I see the developer doesn't really believe in this because I don't see the nonces in the commit messages of the project itself.)
Attempt 168: cb80ebbd975f0028... not prime
[PRIME] Found after 168 attempts! Commit: cb80ebbd975f00288dca70d8fa735c688755f947
Why does it say not prime then prime?
Nice. I think it would be even more æsthetically pointless if it fuzzed the commit date, message whitespace, etc instead of adding a blob...
Whenever you amend a commit, the commit time stamp changes; that ought to be enough, so that the nonce is not required. However, I think it has only second precision, so if you stick to honest wall time, it means 100 attempts require 100 seconds.
This is amazing. A true proof of work. Have you considered finding hashes with leading zeros or making sure each hash starts with 1337?
Why? Fun. Now every commit is a certified 160-bit prime number.
- Miller-Rabin primality test (40 rounds, ~10^-24 false positive rate)
- Fuzzes commit messages with nonces until finding a prime hash
- Average ~368 attempts to find a prime (based on prime density at 2^160)
- Actual performance: 30-120 seconds depending on luck
The philosophy: shouldn't the global distributed compute grid be used to forward number theoretic random non-goals like primality?
Every developer running git-prime contributes cycles to finding 160-bit primes hidden in SHA-1 space. Corporate pointless, but math & aesthets satisfying.
Install:
curl -fsSL https://textonly.github.io/git-prime/install.sh | bash
or irm textonly.github.io/git-prime/install.ps1 | iex
on WinThen just run
git prime-commit -m "my frickin commit message, etc..."
Side note: disappointed that this Show's item ID is NOT prime. 46454369 = 13 × 3573413. Would've been perfect meta-content, ahahWhy not just change the nonce instead of appending it and save some space
Claude, copy git-prime but make it git-hexspeak instead https://en.wikipedia.org/wiki/Hexspeak
But if my git hashes are indivisible, how will people fork my repo? /s
Personally I'd append the Nonce as a git trailer, not to the message body.
And would keep the date constant rather than use the time of each attempt (such that the only thing that actually varies is the Nonce)
And just for more fun... Nonces should only be prime numbers. Probably won't run out :)