The encrypt-text package is a simple npm package for text encryption and decryption using a basic Caesar cipher algorithm. Please note that this package is intended for educational and demonstration purposes and should not be used for sensitive or secure data encryption.
You can install the encrypt-text package in your Node.js project using npm:
npm install text-encryption-service-v1
Once installed, you can use the package by requiring it in your JavaScript code:
const { encrypt, decrypt } = require('encrypt-text');
To encrypt a text using a Caesar cipher, use the encrypt
function:
const encryptedText = encrypt(text, shift);
text
: The text you want to encrypt (a string).shift
: The shift value for the Caesar cipher (an integer).
To decrypt an encrypted text using the same Caesar cipher, use the decrypt
function:
const decryptedText = decrypt(encryptedText, shift);
encryptedText
: The text previously encrypted using theencrypt
function.shift
: The same shift value used for encryption (an integer).
Here's an example of how to use the package:
const { encrypt, decrypt } = require('encrypt-text');
const text = 'Hello, World!';
const shift = 3;
// Encrypt the text
const encryptedText = encrypt(text, shift);
console.log('Encrypted:', encryptedText);
// Decrypt the text
const decryptedText = decrypt(encryptedText, shift);
console.log('Decrypted:', decryptedText);
The package provides basic error handling for invalid input. If you pass incorrect or invalid arguments to the functions, you will receive an error message.
Please be aware that the Caesar cipher used in this package is not suitable for secure data encryption. It is a simple demonstration of encryption principles. For secure applications, consider using industry-standard encryption libraries and algorithms.
This package is released under the ISC License. You can find the full license details in the LICENSE file.
If you would like to contribute to this package or report issues, please visit the package's GitHub repository: GitHub Repository
If you have any questions or need assistance, feel free to contact the package author at shoebfaizan71@gmail.com.
Enjoy using the encrypt-text package!