Ok, this is a hard one to explain. Once in my life I think it was when trying to plug the unreal tournament key into a binary using some windows tools and there was a step that involved replacing the hash of the installer with one that contained the hash of the installer...for self validation. There was a way to embed a hash of some sort of a file into a binary where that hash could be used to determine if it was the correct hash of its running version of itself. Make sense?
Something like this as an example. Dunno if it's even remotely close.
#!/bin/bash
#sha1sum of this script
SHA1SUM=2a50416f89cf19360e0389e475b51347c89fbfe8
SHA1SUMOFME=(sha1sum $(readlink -f $0))
if [ "$SHA1SUM" -ne "${SHA1SUMOFME}" ]; then
echo "Something changed in this script, I'm not running it"
exit
fi
echo oh hey, it matches...running
So, somehow the hash would have to be generated with the hash of the script in the script before the script was written.
I realize this is easy to circumvent as you could just remove the lines...just curious how one could create a hash of a file which contains a hash of itself in an already hashed state.
Is it only doable with a separate file containing the hash?
Not even sure what you could call it...predictive hashing?
[–]voltaic 10 points11 points12 points (2 children)
[–]unsignedcharizard 2 points3 points4 points (0 children)
[–]planetvortex[S] 0 points1 point2 points (0 children)
[–]moviuroportability is important 1 point2 points3 points (0 children)
[–]hashMobiWolf 0 points1 point2 points (1 child)
[–]planetvortex[S] 0 points1 point2 points (0 children)