Package Exports
- neboris
- neboris/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (neboris) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
neboris
A package that allows you encrypt and decrypt text and buffers easily, this package uses
aes-256-ctrand hashes withsha512to encrypt and decrypt text and buffers withInitialization Vectors.
Install
This package can be installed with your preferred package manager for Node.js
$ npm install neboris
$ yarn add neboris
$ pnpm add neborisBenchmark
This package could be a replacement for another package named aes256 and is faster in benchmarks. Bechmarks are ran using the benchmark package. All the benchmark is doing is that it's encrypting and decrypting Hello World! in both text and buffer form using the same key. This benchmark is being ran on a x86_64 GNU/Linux machine.
| Package | OPS |
|---|---|
| aes256 | 20,027 |
| neboris | 23,204 |
Want to test it yourself? Go ahead, you can find the script here. If you do run this script you will need to install the required dependencies with your preferred package manager.
Usage
This package can be used in CommonJS, ESM or Typescript. This package only has one single class Instance that only has two functions which are encrypt and decrypt. The Instance constructor takes one argument which is a string and thats for the key. For both encrypt and decrypt functions they both take one argument that can be either a string or a buffer. In this example the package will encrypt Hello World in both text and buffer form and decrypt it.
const Instance = require('neboris');
const neboris = new Instance('INSERT_KEY_HERE');
const encryptedText = neboris.encrypt('Hello World!');
const decryptedText = neboris.decrypt(encryptedText);
console.log(encryptedText, decryptedText);
const encryptedBuffer = neboris.encrypt(Buffer.from('Hello World!'));
const decryptedBuffer = neboris.decrypt(encryptedBuffer);
console.log(encryptedBuffer, decryptedBuffer);You can generate a key by using the built in crypto module.
const { randomBytes } = require('crypto');
console.log(randomBytes(32).toString('hex'));Notice
This package shouldn't be used to encrypt passwords, you should use bcrypt instead.
License
This project is currently under the MIT license.