Proof of History ( POH ) is a sequence of computation that when checked can provide a way to verify passage of time between two events in a cryptographic way by using hash.
In this example we are going to use MD5 but that can also be sha256 or any other hash mechanism. the idea would be to have 2 functions one that generate the next hash in line and another one that can validate the hash provided is the correct hash.
gen-proof-of-history() { t=$(date +%s-%N) a=($(echo -n "$t-$1" | md5sum )) echo "$t-$a" }
check-proof-of-history() { a=($(echo -n "$1-$2" | md5sum )) echo "$1-$a" }
The function gen-proof-of-history , get only one parameter and and that is the hash of the previous. the output of this function is the hash construct out of the previous hash and the timestamp.
The function check-proof-of-history, get 2 parameters : the first is the timestamp and the second is the prior hash. the output is the next hash that the previous gen had provided.