[1] 2^(144/2) ~= 7e21
[2] 2^(160/2) ~= 1e24
Apart from that, this is a toy project and by no means meant seriously.
Some small corrections:
The script is able to set 5 digits, not 4. The prefixes in the examples are actually 0001a, 0002a, etc. I added the trailing "a" to make the numbers more readable. Otherwise you would get hashes like 00015... which would look awkward. So I'm using the "a" as a kind of separator.
Also, the script refuses to change timestamps by more than 30 minutes. So changing only the committer timestamp would allow you to set only 2-3 hash digits. That's why I'm also changing the author timestamp, which leads to enough possible combinations to set about 5 hash digits. (Unless you're unlucky, because there's always a rest possibility for failure in this kind of algorithms.)
BTW, this program has been inspired by BitCoin's proof of work concept.
Using this script too often may force you to specify more characters to get past the prefix being identical on too many commits.
Apart from that, of course you should use sensible prefixes like "0001", "0002", etc. and not use the same prefix for all commits.
If you find a SHA-1 collision, by any method, you will become very, very famous. It will probably be worth having a broken git repository.
The script prints a suggested "git commit --amend" command so don't run the suggestion if you've already pushed the head of your branch.