A CommonJS-compliant system for secure encryption of smallish secrets
A CommonJS module for symmetric key encryption of smallish secrets
npm install triplesec
require 'triplesec'key = 'top-secret-pw'pt0 = 'the secret!'pt1 = pt0encrypt keydata : pt1decrypt keydata : ciphertextconsolelog "Right back the start! is "
The most expensive part of TripleSec is to derive keys from your given passphrase. This is intentionally so to make it more expensive to crack your password in the case that your ciphertext is stolen. However, you can spread this expense over multiple encryptions if you plan to be encrypting more than once:
require 'triplesec'key = 'top-secret-pw'enc = keydec = keypt0 = 'the secret!'pt1 = pt0pt2 = pt0encrun data : pt1encrun data : pt2decrun data : ct1decrun data : ct2consolelog "Right back the start! is is "
If you want to resalt derived keys with every encryption, you should explicitly ask for that. Otherwise, salt will be reused to speed up encryption (and decryption).
encrun data : pt1encresaltencrun data : pt2