Created
December 18, 2017 20:04
-
-
Save mheap/d5b83695fc647307833eeac37e83e055 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you were looking for a way to describe a set of log messages, where | |
// each item contains the hash of the previous entry to build a chain, what | |
// would you call it? | |
// | |
// It's almost like a blockchain without the proof of work. I'm thinking as | |
// a security measure to prove that no items have been deleted | |
$seed = '52e2fb59e99dcd12528f92af25f401a6'; | |
// Ignore the syntax and assume that $this->message points to the current | |
// array's message | |
$rootNode = [ | |
'msg' => 'This is the original message', | |
'hash' => sha256($this->msg.$seed) | |
]; | |
$node1 = [ | |
'msg' => 'Another message added', | |
'hash' => sha256($this->msg.$rootNodeHash) | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment