Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including string-crypto with all npm packages installed. Try it out:

var StringCrypto = require('string-crypto'); const topSecret = 'What is the largest (rational) number n such that there are positive integers p, q, r such that 1 - 1/p - 1/q - 1/r = 1/n?'; const password = 'Oh-no,not-again'; const { encryptString, decryptString, } = new StringCrypto(); let encryptedString = encryptString(topSecret, password); console.log('Encrypted String:', encryptedString); console.log('Decrypted String:', decryptString(encryptedString, password)); const { encryptString: saferEncrypt, decryptString: saferDecrypt, } = new StringCrypto({ salt: '2f0ijf2039j23r09j2fg45o9ng98um4o', iterations: 10, digest: 'sha3-512', }); encryptedString = saferEncrypt(topSecret, password); console.log('Safer Encrypted String:', encryptedString); console.log('Safer Decrypted String:', saferDecrypt(encryptedString, password));

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

string-crypto v2.0.2

Small and simple (yet secure) library to encrypt and decrypt strings using PBKDF2 for key derivation and AES (defaulted to 256-bit / SHA512)

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free