scryptex
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-s9 • Public • Published

SCryptex docs

Installation

NPM

npm i scryptex
import * as SCryptex from "index"; // esm
const SCryptex = require("index"); // cjs

Hash

let data = "test", data0 = data, data1 = "Test";
let h = SCryptex.hash(data); // data will be hashed
console.log(SCryptex.compareHash(data0, h)); // true
console.log(SCryptex.compareHash(data1, h)); // false

RSA

Generating key pair

let {privateKey, publicKey} = SCryptex.generateRSAKeyPair();

Encrypting

let encrypted = SCryptex.RSAEncrypt(data, publicKey); // data will be encrypted

Decrypting

let decrypted = SCryptex.RSADecrypt(encrypted, privateKey);

Generating keys and encrypting

let {privateKey, publicKey, data: encrypted} = SCryptex.RSAEncrypt(data); // data will be encrypted

RSA class

let rsa = new SCryptex.RSA(); // Keys will be generated
let rsa = new SCryptex.RSA(publicKey, privateKey); // or with generated keys
let rsa = new SCryptex.RSA(publicKey); // or with public key (Decryption is not available)

Encrypting

let encrypted = rsa.encrypt(data); // data will be encrypted

Decrypting

let decrypted = rsa.decrypt(encrypted);

Package Sidebar

Install

npm i scryptex

Weekly Downloads

1

Version

0.0.1-s9

License

ISC

Unpacked Size

817 kB

Total Files

43

Last publish

Collaborators

  • sizoff