; Sha256Text Example ; ------------------ ; Requires Extended mode. q$=Chr(34) ; Double-quote character, for building JSON text ; A save-game as text - hashing it gives a fingerprint we can ; store alongside the file to detect corruption or tampering save_text$="{"+q+"player"+q+":"+q+"Aria"+q+","+q+"gold"+q+":1250}" Print "Save-game text: "+save_text Print "" ; Sha256Text hashes the exact stored bytes and returns ; 64 lowercase hexadecimal characters digest$=Sha256Text(save_text) Print "SHA-256: "+digest Print "" ; Change a single character (gold 1250 -> 1251) and the ; digest changes completely - the avalanche effect tampered$=Replace(save_text,"1250","1251") Print "Tampered text: "+tampered Print "SHA-256: "+Sha256Text(tampered) Print "" Print "One changed digit, a completely different fingerprint." Print "" Print "Press any key to close the example" WaitKey End