encrypt-char
v1.0.2
Published
High performance encryption and decryption tool.
Downloads
10
Maintainers
Readme
Features
- Zero dependencies.
- Works with any NodeJs projects.
- High performance and security.
- Simple usage.
Install
Install with NPM or YARN:
$ npm i encrypt-char
or
$ yarn add encrypt-char
Methods
Generate a New Keychar
encryptChar.generateKey(salt, password)
import { encryptChar } from 'encrypt-char';
const mySalt = 6;
const mySecretPassword = 'secretPassword1234';
const myKeychar = encryptChar.generateKey(mySalt, mySecretPassword);
// return BEGIN KEY ---34230LPRYjLw0kaNhXUtNmdk0juT0278W756LH9MNox2....--- END KEY
Hard Encode Data
encryptChar.hardEncode(data, keychar, password)
import { encryptChar } from 'encrypt-char';
const mySecretPassword = 'secretPassword1234';
const myText = 'Lorem ipsum dolor sit amet. 1234567890 !@#$%^&*()_+';
const resultEncode = encryptChar.hardEncode(
myText,
myKeychar,
mySecretPassword
);
// return 'hYjIzzH1Mjw1no7CeoA5Flnb3VQR6PKC4VmxZJLC9s2leCGv0NLxe9fdQUmDe9fx6NLA'
Hard Decode Data
encryptChar.hardDecode(encodedData, keychar, password)
import { encryptChar } from 'encrypt-char';
const mySecretPassword = 'secretPassword1234';
const myEncodedText =
'hYjIzzH1Mjw1no7CeoA5Flnb3VQR6PKC4VmxZJLC9s2leCGv0NLxe9fdQUmDe9fx6NLA';
const resultDecode = encryptChar.hardDecode(
myEncodedText,
myKeychar,
mySecretPassword
);
// return 'Lorem ipsum dolor sit amet. 1234567890 !@#$%^&*()_+'
Soft Encode Data
encryptChar.softEncode(data)
import { encryptChar } from 'encrypt-char';
const myText = 'Lorem ipsum dolor sit amet. 1234567890 !@#$%^&*()_+';
const resultEncode = encryptChar.softEncode(myText);
// return 'r8VKooiJeVCJjAUIgATO4cjN1QzMyEDIuQXZtFGI0l2cgI3bs9GZg0WdzBXag0WZy9GT'
Soft Decode Data
encryptChar.softDecode(encodedData)
import { encryptChar } from 'encrypt-char';
const myEncodedText =
'r8VKooiJeVCJjAUIgATO4cjN1QzMyEDIuQXZtFGI0l2cgI3bs9GZg0WdzBXag0WZy9GT';
const resultDecode = encryptChar.softDecode(myEncodedText);
// return 'Lorem ipsum dolor sit amet. 1234567890 !@#$%^&*()_+'
Parameters
encryptChar.generateKey(salt: number, password: string)
The "salt" to increase the encoding complexity. The "password" to sign and validate keychar.
encryptChar.hardEncode(data: string, keychar: string, password: string)
The "data" text to encode. The "keychar" generated to encode text. The "password" to sign and validate keychar.
encryptChar.hardDecode(encodedData: string, keychar: string, password: string)
The "encodedData" text previously encoded. The "keychar" generated to decode text. The "password" to sign and validate keychar.
encryptChar.softEncode(data: string)
The "data" text to encode.
encryptChar.softDecode(encodedData: string)
The "encodedData" text previously encoded.
Recomendations
Store the generated "keychar" and "password" in a safe place!
The "keychar" is a unique key that guarantees encoding and decoding using only in "hardEncode" and "hardDecode" methods. Losing the "keychar" or "password" makes it impossible to reverse any encoded text.
Autor
| @anselmodev | | :--------------------------------------------------------------------------------------------------------------------------------: |