emPOWer your commits. Pointlessly flex on your coworkers with bespoke commit hashes, all with the convenience of a single command. A Proof of Work is

CouleeApps / git-power

submited by
Style Pass
2021-07-08 08:00:07

emPOWer your commits. Pointlessly flex on your coworkers with bespoke commit hashes, all with the convenience of a single command.

A Proof of Work is a cryptographic proof that an amount of work has been done. Often, these are seen in the form of Hash(data || nonce) where the result of the hash has some number of leading zero bits. Since hashes are one-way functions, this is effectively a O(2^n) brute force for n leading zero bits. Since git commits are identified with a hash, and you can insert arbitrary fields into a commit header, you can generate many hashes for one set of changes and effectively compute a Proof of Work for a git commit. This tool does that, with a configurable number of threads and leading zero bits on the commit hash.

Reasonably. On my Intel i9 9880H @ 2.3GHz with 16 threads, it can compute about 12MH/s at peak CPU core boost clocks. If you account for the less-than-stellar MacBook thermals, it drops to about 8MH/s. But assuming you can get good speeds, and assuming you want to calculate a hash with 32 leading zero bits, this should take (2^32 / 12,000,000) ~= 360 seconds on average, though the variance is pretty high. Hashcat's benchmark reports my CPU can do about 315MH/s for SHA-1, so OpenSSL's hash implementation is probably not optimized well for this. Maybe someone can look into adapting Hashcat into this, but it's a bit beyond the scope I'm willing to do.

git-power operates on the git repository in the current working directory. The only supported run options are the number of leading bits to brute-force and the number of threads created to do the work. By default, git-power will use 32 bits and the max number of hardware threads supported.

Leave a Comment
Related Posts