npm install cryptr

a simple encrypt and decrypt module for node.js

About cryptr

Cryptr is an essential npm package designed specifically for Node.js applications requiring simple yet robust encryption and decryption functionalities. This module leverages the powerful AES-256-GCM encryption algorithm, ensuring that the data handled is protected with one of the most secure encryption standards available today. Particularly useful for developers needing to encrypt UTF-8 strings that may need to be decrypted later, Cryptr stands out for its ease of use and efficiency in managing sensitive information securely. Whether you are developing a commercial product or a personal project, incorporating Cryptr can significantly enhance your application's security layer.

To integrate Cryptr into your Node.js project, the process is straightforward: simply use the command `npm install cryptr`. This command installs the Cryptr module, enabling developers to start encrypting and decrypting data within their applications quickly. The simplicity of this installation process is a key benefit, as it allows developers to implement advanced encryption functionalities without the need for extensive cryptographic knowledge or dealing with complex setup procedures. Once installed, Cryptr can be easily configured to suit the specific security needs of your application, making it a flexible choice for many programming environments.

Cryptr's utility in real-world applications is vast, ranging from securing user credentials to encrypting confidential configuration settings before storage or transmission. By using Cryptr, developers can ensure that sensitive data remains inaccessible to unauthorized users, thereby upholding privacy and compliance with data protection regulations. Moreover, the use of Cryptr helps in building trust with end-users, as it demonstrates a commitment to safeguarding personal and business-critical data. For any application where data security is a priority, integrating Cryptr provides a straightforward, reliable solution to meet modern encryption needs.

More from MauriceButler

MauriceButler npm packages

Find the best node modules for your project.

Search npm

cryptr

a simple encrypt and decrypt module for node...

Read more

Dependencies

Core dependencies of this npm package and its dev dependencies.

tape

Documentation

A README file for the cryptr code repository. View Code

cryptr

cryptr is a simple aes-256-gcm encrypt and decrypt module for node.js

It is for doing simple encryption of values UTF-8 strings that need to be decrypted at a later time.

If you require anything more than that you probably want to use something more advanced or crypto directly.

The Cryptr constructor takes 1 required argument, and an optional options object.

Cryptr(secret[, options])

The salt and iv are randomly generated and prepended to the result.

DO NOT USE THIS MODULE FOR ENCRYPTING PASSWORDS!

Passwords should be a one way hash. Use bcrypt for that.

Install

npm install cryptr

Usage

const Cryptr = require('cryptr');
const cryptr = new Cryptr('myTotallySecretKey');

const encryptedString = cryptr.encrypt('bacon');
const decryptedString = cryptr.decrypt(encryptedString);

console.log(encryptedString); // 2a3260f5ac4754b8ee3021ad413ddbc11f04138d01fe0c5889a0dd7b4a97e342a4f43bb43f3c83033626a76f7ace2479705ec7579e4c151f2e2196455be09b29bfc9055f82cdc92a1fe735825af1f75cfb9c94ad765c06a8abe9668fca5c42d45a7ec233f0
console.log(decryptedString); // bacon

With Options

const Cryptr = require('cryptr');
const cryptr = new Cryptr('myTotallySecretKey', { encoding: 'base64', pbkdf2Iterations: 10000, saltLength: 10 });

const encryptedString = cryptr.encrypt('bacon');
const decryptedString = cryptr.decrypt(encryptedString);

console.log(encryptedString); // CPbKO/FFLQ8lVKxV+jYJcLcpTU0ZvW3D+JVfUecmJmLYY10UxYEa/wf8PWDQqhw=
console.log(decryptedString); // bacon