Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-vanity

Rust CI License

Bruteforce Git commit metadata to mint beautiful, ego-boosting vanity SHA-1 hashes.


What is this?

git-vanity is a Rust CLI that bruteforces commit metadata (author name, timestamps, message padding…) until the resulting SHA-1 matches your pattern — prefix, suffix, or substring.

Want your commit to start with deadbeef? Done. End with c0ffee? Easy. Flex on your coworkers with 1337 inside? You sick, beautiful genius.

How it works

A commit hash is the SHA-1 of the commit object:

commit 240\0
tree 4a20283f…
parent 1a2b3c4d…
author Chad Developer <chad@example.com> 1700000000 +0000
committer Chad Developer <chad@example.com> 1700000000 +0000

Fix the thing that was broken

Change any byte — pad the author name, nudge the timestamp — and the hash changes completely. git-vanity tries millions of harmless metadata variations in parallel (rayon) until one matches.

The tree (your actual code) is never touched. Only metadata mutates.

⚠️ Warning

Rewriting history rewrites hashes. Don't rewrite commits that are already pushed — divergent history, angry coworkers, broken CI, disappointed dog.

Use git-vanity create for new commits, rewrite only on local ones.

Install

# straight from this repo
cargo install --git https://github.com/suggydev/git-vanity

# or from source
git clone https://github.com/suggydev/git-vanity && cd git-vanity
cargo build --release   # → target/release/git-vanity

Usage

# stage changes, then mint a new commit
git-vanity create --prefix dead
git-vanity create --all --prefix c0ffee      # auto-stage everything
git-vanity create --suffix beef              # suffix match
git-vanity create --contains 1337            # substring match
git-vanity create --prefix dead --suffix beef  # combined

# rewrite the last (local!) commit
git-vanity rewrite --prefix cafe
git-vanity rewrite HEAD~1 --prefix babe

# quality of life
git-vanity create --prefix cafe --coffee     # coffee facts while you wait
git-vanity create --prefix 000000 --force    # we won't judge (much)

Benchmarks

AMD Ryzen 9 5900X (12c/24t), rewrite mode:

Pattern Target Avg. time Approx. attempts
4 chars --prefix dead ~1 s ~6.5·10⁴
5 chars --prefix decaf ~15 s ~10⁶
6 chars --prefix decafe ~1 m ~1.6·10⁷
7 chars --prefix deadbee ~15 m ~2.7·10⁸
8 chars --prefix deadbeef ~4 h ~4.3·10⁹

Times are probabilistic: difficulty grows 16× per extra hex char.

Development

cargo test    # unit tests (hasher, pattern)
cargo clippy

Contributing

Ideas for new metadata mutations — trailers, exotic Unicode whitespace, env-dependent padding? Open an issue or a PR.

License

MIT — see LICENSE. If you find a SHA-1 collision, keep it as an easter egg.

About

Rust CLI that bruteforces Git commit metadata to mint vanity SHA-1 hashes

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages