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 @sounisi5011/encrypted-archive
with all npm
packages installed. Try it out:
const { encrypt, decrypt } = require('@sounisi5011/encrypted-archive');
const cleartext = 'Hello World!';
const password = '123456';
const encryptedData = await encrypt(cleartext, password, {
// These options are optional, but it is recommended that you specify the appropriate options for your application.
algorithm: 'chacha20-poly1305',
keyDerivation: {
algorithm: 'argon2d',
iterations: 3,
memory: 12,
parallelism: 1,
},
// If the data to be encrypted is text, you can also compress the data
// Binary data (e.g. images, videos, etc.) can also be compressed,
// but the effect of compression is often small and is not recommended.
compress: 'gzip',
});
console.log('Encrypted Data:', encryptedData);
const decryptedData = await decrypt(encryptedData, password);
console.log('Decrypted String:', decryptedData.toString('utf8'));
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.