Simple library for encrypting/decrypting strings without the boilerplate of the crypt library.
Simplecrypt is intended to be a very basic, concise library for doing one thing: encrypting strings. By default, it makes a lot of assumptions for you, like what type of encryption to use (AES 192), what to use for the key (cryptographically strong random data), how large to make the key (256 bytes), the encoding to use (hex dump for ciphered, UTF-8 for deciphered). Some of these you can change (the encryption type, and the key), but the focus here is simplicity.
Important note: if you do not specify the key, a random one is generated. If you plan on storing the encrypted digest somewhere, then you will need to specify a key or retrieve the key from the simplecrypt instance.
npm install simplecrypt
var simplecrypt = require"simplecrypt";var sc = simplecrypt;var digest = scencrypt"my secret";console.logdigest; // "66cea6eb1c18b8862485cf0604fa6062"var message = scdecryptdigest;console.logmessage; // "my secret"
Instantiates a new simplecrypt object.
Optionally specify options to override default settings.
returns instance of the simplecrypt library
message: (string) message to encrypt returns (string) encrypted message as hex string
digest: (string) encrypted message returns (string) original message, unencrypted
returns (string|Buffer) password used for encryption
returns (string) salt used