::= #
sha-256
::= [https://en.wikipedia.org/wiki/SHA-2]
An atom-form expression such as (@)
, (c)
, (v)
, (s)
, (w)
, or (m)
can include an optional hash value. The value is the result of hashing the last successfully evaluated expression using the SHA-256 algorithm. It is important to note that the hash value is not the value of hashing the current expression but rather the value of hashing the expression which came before it. In this way, the hash value of the previous expression can be included in this expression's hash to form an irrevocable chain. An engine could use an atom's hash to locate it uniquely or to recall its contents without finding where the atom "lives" in the existing MSL stream.
If three expressions are evaluated in sequence and the second expression contains the hash of the first and the third expression contains the hash of the second, a chain of edits can be established with each expression's precedents being established with absolute certainty, as with a blockchain.
In the following examples, pseudonyms (such as hash-of-previous-expression
) will be used instead of actual hash values to better delineate the chaining function:
(@p1 It was a dark and stormy night. #hash-of-previous-expression)
(@p2 The wind blew fiercely through the woods. #hash-of-@p1)
(@p1 It was a dark and windy night. #hash-of-@p2)
(v ch1 (@p1) (@p2 The thick scent of jasmine loomed in the air.) #hash-of-last-value-of-@p1)
Hash values can be used in a viewer or engine to facilitate indexing of atoms. Hash values can also be exported by a viewer to an external program which tracks them independently of the content to provide a blockchain verification service.
If every atom-form expression is hashed in this way, recording those hashes externally prevents surreptitious editing of MSL text files with the intent to misrepresent the chain of edits. A bad actor attempting to assert that different text was supplied to (@p1)
in step #3, for example, could be identified because the hash of that step #3 would not be the same as the one recorded in step #4. If every expression were hashed and recorded externally, it would be simple to detect where the alteration was attempted.