{"id":25808585,"url":"https://github.com/couleeapps/git-power","last_synced_at":"2025-04-12T21:27:31.898Z","repository":{"id":40781867,"uuid":"379744690","full_name":"CouleeApps/git-power","owner":"CouleeApps","description":"git is a blockchain. Start your commit hashes with 00000000 like a real blockchain should.","archived":false,"fork":false,"pushed_at":"2024-10-27T18:25:19.000Z","size":47,"stargazers_count":255,"open_issues_count":3,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T07:17:28.004Z","etag":null,"topics":["git","proof-of-work"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CouleeApps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-23T22:35:43.000Z","updated_at":"2025-03-12T10:29:45.000Z","dependencies_parsed_at":"2024-10-27T18:37:23.799Z","dependency_job_id":"ab13ffea-d942-4f9a-a8aa-5b13ebb63f32","html_url":"https://github.com/CouleeApps/git-power","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CouleeApps%2Fgit-power","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CouleeApps%2Fgit-power/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CouleeApps%2Fgit-power/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CouleeApps%2Fgit-power/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CouleeApps","download_url":"https://codeload.github.com/CouleeApps/git-power/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633657,"owners_count":21136897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","proof-of-work"],"created_at":"2025-02-27T22:29:00.548Z","updated_at":"2025-04-12T21:27:31.849Z","avatar_url":"https://github.com/CouleeApps.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `git-power`\nemPOWer your commits. Pointlessly flex on your coworkers with bespoke commit hashes,\nall with the convenience of a single command.\n\n[\u003cimg width=\"795\" alt=\"demo\" src=\"https://user-images.githubusercontent.com/711973/124827890-92e23300-df44-11eb-8702-7627f7c4170b.png\"\u003e](https://github.com/CouleeApps/git-power/commits/master)\n\n## What is it?\nA [Proof of Work](https://en.wikipedia.org/wiki/Proof_of_work) is a cryptographic proof\nthat an amount of work has been done. Often, these are seen in the form of\n`Hash(data || nonce)` where the result of the hash has some number of leading zero bits.\nSince hashes are one-way functions, this is effectively a O(2^n) brute force for n leading\nzero bits. Since git commits are identified with a hash, and you can insert arbitrary\nfields into a commit header, you can generate many hashes for one set of changes and\neffectively compute a Proof of Work for a git commit. This tool does that, with a\nconfigurable number of threads and leading zero bits on the commit hash.\n\n## Why?\nSome joke about \"Git is a blockchain\" went too far, now we have this.\n\n## Is it fast?\nReasonably. On my fanless M2 MacBook Air, it can compute about 30MH/s at\npeak CPU core boost clocks. If you account for the less-than-stellar MacBook thermals, it\ndrops to about 21MH/s. But assuming you can get good speeds, and assuming you want to\ncalculate a hash with 32 leading zero bits, this should take\n(2^32 / 30,000,000) ~= 140 seconds on average, though the variance is pretty high.\nHashcat's benchmark reports my CPU can do about 725MH/s for SHA-1, so OpenSSL's hash\nimplementation is probably not optimized well for this. Maybe someone can look into\nadapting Hashcat into this, but it's a bit beyond the scope I'm willing to do.\n\n## Usage\n\n    git-power [bits [threads]]\n\n`git-power` operates on the git repository in the current working directory.\nThe only supported run options are the number of leading bits to brute-force and the\nnumber of threads created to do the work. By default, `git-power` will use 32 bits and\nthe max number of hardware threads supported.\n\nWhen a matching commit hash is found, it will automatically update your repository HEAD\nand replace the latest commit. NEW: If your commit is GPG-signed, it will stay signed\neven after running this! See the source for details on how this witchcraft is performed.\n\n### Retroactively\n\nIf you want to retroactively emPOWer all of your commits, you can combine `git power`\nwith the brilliance of `git rebase --interactive`:\n\n    # emPOWer entire tree (preferred method)\n    git rebase --interactive --exec \"git power\" --root\n\n    # emPOWer unpushed commits\n    git rebase --interactive --exec \"git power\" origin/master\n\n    # emPOWer everything after a specific commit\n    git rebase --interactive --exec \"git power\" 00000000da6a1220576d8c00dff8aa9619b44048\n\n## Building\n\n### Linux\nThis tool requires `cmake`, `libgit2`, and `OpenSSL` to build. You can get `libgit2` and\n`OpenSSL` through your package manager, or at [libgit2.org](https://libgit2.org/).\nBuild steps are straight-forward from there:\n\n    cmake -B build \u0026\u0026 cmake --build build\n\n### macOS\nOn macOS, Apple is rude and won't let you link with the system-provided `libcrypto`, so\nyou need to `brew install openssl` (or build it yourself). Then you can pretend you have a\nreal unix system:\n\n    cmake -B build -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \u0026\u0026 cmake --build build\n\n### Windows\nOn Windows, you need to compile `libgit2` and `OpenSSL` yourself. Then just point `cmake`\nat them, and you should be good:\n\n    # Be sure to specify the correct arch\n    cmake -B build -A x64 \"-DCMAKE_PREFIX_PATH=C:\\Program Files\\libgit2\" \"-DOPENSSL_ROOT_DIR=C:\\Program Files\\OpenSSL\"\n    cmake --build build\n\n## Installing\n\n### macOS / Linux\nFirst, install via `cmake`:\n\n    cmake --install build\n\nThen, you can use it through `git` like any other utility:\n\n    # Default settings: 32 and \u003chardware thread count\u003e\n    git power\n\n    # MacBook-friendly\n    git power 24 8\n\n### Windows\nDrop `git-power.exe`, `git2.dll`, and `crypto.dll` in your git installation's `bin`\ndirectory. On my machine, that's at `C:\\Program Files\\Git\\mingw64\\bin`. Then you can use\nit like normal.\n\n    # Default settings: 32 and \u003chardware thread count\u003e\n    git power\n\n    # APU-friendly\n    git power 24 8\n\n## License\nMIT license. I'm really not sure who would want to reuse this, but it's here if you want.\n\n## How long did you spend running it on this repo\nToo long.\n\n## Will you Rewrite it in Rust (TM)?\n~~It wouldn't be too hard. Feel free to submit a pull request whose commit hash starts with\nat least 32 zero bits.~~ [I have received news that someone is doing this.](https://github.com/mkrasnitski/git-power-rs).\n\nThere is also [lucky-commit, written in Rust](https://github.com/not-an-aardvark/lucky-commit),\nthat has the same idea as `git-power`, but with GPU acceleration and the ability to choose\na custom prefix. Looks like their Rust implementation (with or without GPU) is significantly\nfaster than this C++ implementation. Crab language wins again, so it seems.\n\n## Please apologize for creating this\nSorry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouleeapps%2Fgit-power","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouleeapps%2Fgit-power","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouleeapps%2Fgit-power/lists"}