1.1.4 • Published 2 years ago
@lproject/dsea v1.1.4
DSEA (Data Shift Encryption Algorithm)
DSEA is an encryption algorithm built by LProject on npm that puts your data through a series of shifts and scrambles so much so that the result is unreadable to everyone but the person with the key used to encrypt it.
Features
- Easy & Fast Encryption/Decryption
- File Encryption/Decryption
- Key Generation
Before Using DSEA:
Understand that:
- DSEA is not a passwordless encryption method
- DSEA should only be used for general usage NOT things such as large file encryption or encrypting confidential documents.
- When DSEA is used to encrypt large data/files, it can be a bit slow in some cases.
Now, let's get started!
Installation
Install DSEA npm module.
npm i @lproject/dsea
Functions
These are the functions that DSEA provides
Function | Arguments | Description |
---|---|---|
Encrypt | (Data), (Key) | Encrypt data with the provided key. |
Decrypt | (Data), (Key) | Decrypt encrypted data with the corresponding key. |
IsEnc | (Data) | Verify if the data provided is encrypted. |
GenerateKey | None | Generate a key to use with Encrypt, Decrypt, etc. |
FileEncrypt | (File Path), (Key) | Encrypt a file with the provided key. |
FileDecrypt | (File Path), (Key) | Decrypt an encrypted file with the corresponding key. |
SetLogFile | (File Path) | Set the file that DSEA will log all events like Encrypt, Decrypt, etc. |
GetLog | None | Output the current log file in JSON format. |
Usage
Import the module
var dsea = require("@lproject/dsea");
Encrypt / Decrypt
var key = "secret_key";
var data = "Hello World!";
// Encrypt
var encrypted = dsea.Encrypt(data, key);
// Decrypt
var decrypted = dsea.Decrypt(encrypted, key);
IsEnc
// Encrypt something
var encrypted = dsea.Encrypt("Hello World!", "secret_key");
// Check it its encrypted
var is_encrypted = dsea.IsEnc(encrypted);
console.log(is_encrypted); // Will output true if the data is encrypted or will output false if the data is not encrypted
GenerateKey
var key = dsea.GenerateKey(); // Generate the key
// Use the key to encrypt data
var encrypted = dsea.Encrypt("Hello World!", key);
Encrypt / Decrypt File
// Encrypt the file
dsea.FileEncrypt("./file.txt", "key");
// Decrypt the file
dsea.FileDecrypt("./file.txt", "key");
SetLogFile
// Set the file
dsea.SetLogFile("./example.log")
// NOTE: File has to be of type .log
GetLog
// Set the file from before
dsea.SetLogFile("./example.log")
// Get the log
var log = dsea.GetLog().Log;
DSEA is only in the testing phase, if you notice any errors that you may come across it's completely normal.