1.0.0 • Published 5 years ago

crypthawk v1.0.0

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
5 years ago

CRYPTHAWK Crypthawk is an encryption algorithm that lets you powerfully encrypt information. Depending on your settings, you can turn a 2KB file into something much higher, say 2MB (or even 2GB if you're absolutely insane and have enough storage to backup all of the internet).

Keys work as objects and contain 2 items. (value) and (level). The value is the string that composes the key, and the level is how strong you want the encryption generated from the value to be. On top of the level, the greater the length of the keys value the greater the outcome.

EXAMPLE

const {encrypt, decrypt} = require('crypthawk');

const _key = {
    value: "my_secret_key",
    level: 4
}
//Set identical keys to simulate a success.
//edit either the level or any character in
//value to get an error.
const _key2 = {
    value: "my_secret_key",
    level: 4
}

encrypt("This is a string encryption", _key, (err, data, size) => {
    console.log(data);
    console.log(size);
    if (!err) {
        console.log('Encryption Success');
        decrypt(data, _key2, (err, data) => {
            console.log(err, data);
        })
    } else {
        console.log('Some weird magic happned.', err)
    }
});

JSON While this is meant for JSON, it'll automatically encrypt either JSON data or a string. If you've encrypted JSON data, then upon decrypting you will get JSON data.

ENCRYPT

encrypt(string/json, key, callback(err, data, size) => {});

size will return an array of the original data (JSON or string), in bytes and the new size of the encrypted data (JSON or string) in bytes.

DECRYPT

decrypt(encrypted_string, key, callback(err, data) => {});