dikacryptjs
v3.0.2
Published
Encrypt and Decrypt System in Node JS
Downloads
51
Maintainers
Readme
Dika CryptJS
A Javascript Encrypt and Decrypt Module
Instalation
npm i dikacryptjs
Usage
const DikaCryptJS = require("dikacryptjs")
const CryptJS = new DikaCryptJS.CryptJS({
useHex: true | false (Default: true),
useBase64: true | false (Default: true)
})
//Generate salt
const salt = CryptJS.genSaltSync()
//Encrypt
//Using Hex and Base64
console.log(CryptJS.encrypt("Text", salt, "Hex" | "Base64"))
//Return to Hex: 566b314856465a4b4e47746b576b46485056553965513d3d
//Return to Base64: NTY0ZDQ3NTQ1NjRhMzQ2YjY0NWE0MTQ3M2Q1NTNkNzk=
//Only Using Hex
console.log(CryptJS.encrypt("Text", salt))
//Return to Hex: 564d4754564a346b645a41473d553d79
//Only Using Base64
console.log(CryptJS.encrypt("Text", salt))
//Return to Base64: Vk1HVFZKNGtkWkFHPVU9eQ==
//Decrypt
//Using Hex and Base64
console.log(CryptJS.decrypt("566b314856465a4b4e47746b576b46485056553965513d3d", salt "Hex"))
//Result: "Text"
console.log(CryptJS.decrypt("NTY0ZDQ3NTQ1NjRhMzQ2YjY0NWE0MTQ3M2Q1NTNkNzk=", salt, "Base64"))
//Result: "Text"
//Only Using Hex
console.log(CryptJS.encrypt("566b314856465a4b4e47746b576b46485056553965513d3d", salt))
//Result: "Text"
//Only Using Base64
console.log(CryptJS.encrypt("NTY0ZDQ3NTQ1NjRhMzQ2YjY0NWE0MTQ3M2Q1NTNkNzk=", salt))
//Result: "Text"
Donate
| Donate | Link | | ------ | ------ | | Saweria | https://saweria.co/IDikaN |