JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q37669F
  • License ISC

Encrypt and Decrypt System in Node JS

Package Exports

  • dikacryptjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dikacryptjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Dika CryptJS

Download Donate

A Javascript Encrypt and Decrypt Module

Instalation

npm i dikacryptjs

Usage

const DikaCryptJS = require("dikacryptjs")
const CryptJS = new DikaCryptJS.CryptJS()

//Generate salt
const salt = CryptJS.genSaltSync()

//Encrypt

//Using Hex and Base64
console.log(CryptJS.encrypt("Text", salt, {
    useHex: true, //Using Hex To Encrypt
    useBase64: true, //Using Base64 To Encrypt
    return: "hex" | "base64" //Return to Hex or Base64
}))
//Return to Hex: 566b314856465a4b4e47746b576b46485056553965513d3d
//Return to Base64: NTY0ZDQ3NTQ1NjRhMzQ2YjY0NWE0MTQ3M2Q1NTNkNzk=

//Only Using Hex
console.log(CryptJS.encrypt("Text", salt, {
    useHex: true, //Using Hex To Encrypt
    useBase64: false, //Not Using Base64 To Encrypt
}))
//Return to Hex: 564d4754564a346b645a41473d553d79

//Only Using Base64
console.log(CryptJS.encrypt("Text", salt, {
    useHex: false, //Not Using Hex To Encrypt
    useBase64: true, //Using Base64 To Encrypt
}))
//Return to Base64: Vk1HVFZKNGtkWkFHPVU9eQ==

//Decrypt

//Using Hex and Base64
console.log(CryptJS.decrypt("566b314856465a4b4e47746b576b46485056553965513d3d", salt, {
    useHex: true, //Using Hex To Decrypt
    useBase64: true, //Using Base64 To Decrypt
    encryptType: "hex" //Returned Hex While Encrypt
}))
//Result: "Text"

console.log(CryptJS.decrypt("NTY0ZDQ3NTQ1NjRhMzQ2YjY0NWE0MTQ3M2Q1NTNkNzk=", salt, {
    useHex: true, //Using Hex To Decrypt
    useBase64: true, //Using Base64 To Decrypt
    encryptType: "base64" //Returned Base64 While Encrypt
}))
//Result: "Text"

//Only Using Hex
console.log(CryptJS.encrypt("566b314856465a4b4e47746b576b46485056553965513d3d", salt, {
    useHex: true, //Using Hex To Decrypt
    useBase64: false, //Not Using Base64 To Decrypt
}))
//Result: "Text"

//Only Using Base64
console.log(CryptJS.encrypt("NTY0ZDQ3NTQ1NjRhMzQ2YjY0NWE0MTQ3M2Q1NTNkNzk=", salt, {
    useHex: false, //Not Using Hex To Decrypt
    useBase64: true, //Using Base64 To Decrypt
}))
//Result: "Text"
Donate Link
Saweria https://saweria.co/IDikaN