Let me tell you why this is a tricky issue using git internals. You can get sha1 of the current commit with
#!/bin/bash commit=$(git cat-file commit HEAD) # sha1=($((printf "commit %s\0" $(echo "$commit" | wc -c); echo "$commit") | sha1sum)) echo ${sha1[0]}
Essentially, you run the sha1 checksum in the message returned by git cat-file commit HEAD . Two things immediately jump out due to a problem while viewing this post. One of them is the sha1 tree, and the second is the commit time.
Now the fixation time can be easily taken care of by changing the message and guessing how long it will take for the fixation or planning to fix it at a specific time. The real problem is the sha1 tree, which you can get from git ls-tree $(git write-tree) | git mktree git ls-tree $(git write-tree) | git mktree . Essentially, you execute the sha1 checksum in a message from ls-tree, which is a list of all files and their sha1 checksum.
Therefore, your checksum sha1 depends on your checksum sha1 of the tree, which directly depends on the checksum sha1 files, which completes the circle and depends on commit sha1. So you have a circular problem with the methods available to me.
With less secure checksums, it has been shown that it is possible to write a file checksum to a file directly using brute force; however, I do not know any work that accomplished this task with sha1. This is not impossible, but almost impossible with our current understanding (but who knows, maybe in a couple of years it will be trivial). However, this is even more difficult for brute force, since you need to write the checksum (commit) of the checksum (tree) of the checksum (blob) to the file.
Novice C Sep 29 '17 at 0:37 2017-09-29 00:37
source share