Skip to content

vssizoff/SCryptex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published