A Node.js library for encrypt and compress your file/dir into a binary file. (NRoot_Project)
Project details
ncrypt is a fast and lightweight encryption library for Node.js. It provides authenticated encryption, MessagePack serialization, and built-in compression through a simple API. Supporting AES-GCM and ChaCha20-Poly1305, it is ideal for secure data storage, custom binary formats, and high-performance applications. It also integrates seamlessly with NArchive for advanced archiving.
ncrypt is a high-performance, secure, and lightweight Node.js library designed for binary file encryption, compression, and serialization. By combining the speed of MessagePack serialization, flexible compression algorithms, and authenticated AES-256-GCM encryption, ncrypt provides a robust, tamper-proof solution for handling custom .ncrypt file structures.
AES-256-GCM, AES-128-GCM, and ChaCha20-Poly1305) ensuring data integrity and detecting tampering or corruption.1 (Fastest) to 15 (Maximum Compression).scrypt with unique salts to resist dictionary and rainbow table attacks.crypto module with no heavy cryptographic dependencies.Install ncrypt via npm:
npm install @nroot_project/ncrypt
For handling with better performance, we'd used NArchive for archiving and directory and files.
https:/Nima389/NArchive
You can install the NArchive via npm:
npm install @nroot_project/narchive
import { NCrypt } from "@nroot_project/ncrypt";
async function main() {
const secretData = {
user: "alice",
role: "admin",
sensitiveInfo: [10, 20, 30],
};
const password = "SuperSecretPassword123!";
// Encrypt & Compress
const encryptedBuffer = await NCrypt.encrypt(secretData, password, {
algorithm: "aes-256-gcm",
compressionLevel: 6,
});
// Decrypt
const decryptedData = await NCrypt.decrypt(encryptedBuffer, password);
console.log(decryptedData);
}
main();
Output
{
user: "alice",
role: "admin",
sensitiveInfo: [10, 20, 30]
}
| Type | Options |
|---|---|
| Encryption | aes-256-gcm (Default), aes-128-gcm, chacha20-poly1305 |
| Key Derivation (KDF) | scrypt (Native Node.js implementation) |
| Serialization | MessagePack |
| Compression Level | 1 (Fastest) → 15 (Best Compression) |
ncrypt is actively developed and maintained by the nroot_project organization. Our goal is to build ultra-fast, developer-first tools for secure data handling in Node.js.
For high-performance directory bundling and archiving, check out NArchive, which integrates seamlessly with ncrypt.
npm install @nroot_project/narchive
Issues, feature requests, and Pull Requests are always welcome!
MIT © nroot_project
Comments
0Start the conversation
Share the first comment.