Golds

Hashed data is secure because it is impossible to reverse engineer a hash. In this example, I have hashed several goals. Only I should be aware of this original text but obviously in this demo I've shared the secret sauce.

If wanted to encrypt data then be able to decrypt it, I would need a different approach. If I can't use hashes, how can I encrypt then decrypt this data?

If we understand that encryption is always reverseable, what can we do protect the data?

Hashed Secret Key

Encrypted Goal

Encrypted Major Bonus

Encrypted Minor Bonus

Encrypted Sidequest Bonus

Decrypted Sidequest Bonus

SHA512 will generate 128 characters of lowercase HEX characters (0 to f) so that when we create the database table we can choose char(128) over varchar(255) since we know the hash will be fixed length of 128 each time.

Further Reading

Pigeon Principle

Hashing vs Encryption

Encrypting and Decrypting with Javascript

Clojure and ClojureScript encryption with NaCL

Clojure & Libsodium

Python also talks to NaCL