Skip to content

cascade encryption using Serpent Twofish and AES for the browser and nodejs

License

Notifications You must be signed in to change notification settings

angeal185/xcrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xcrypt

nodejs

const xcrypt = require('xcrypt');

browser

import { xcrypt } from './dist/xcrypt.mjs';

or

<script src="./dist/xcrypt.min.js"></script>

API

let encode = 'hex', // 'base64'
data = 'test text';

let obj = {
  key: xcrypt.generateKey(encode),
  key2x: [xcrypt.generateKey(encode), xcrypt.generateKey(encode)],
  key3x: [xcrypt.generateKey(encode), xcrypt.generateKey(encode), xcrypt.generateKey(encode)],
  algo: 'TWOFISH',
  algo2x: ['TWOFISH', 'SERPENT'],
  algo3x: ['TWOFISH', 'SERPENT', 'AES']
}

obj.ctext = xcrypt.enc(data, obj.key, obj.algo, encode);
obj.ptext = xcrypt.dec(obj.ctext, obj.key, obj.algo, encode)

obj.ctext2x = xcrypt.enc2x(data, obj.key2x, obj.algo2x, encode);
obj.ptext2x = xcrypt.dec2x(obj.ctext2x, obj.key2x, obj.algo2x, encode);

obj.ctext3x = xcrypt.enc3x(data, obj.key3x, obj.algo3x, encode);
obj.ptext3x = xcrypt.dec3x(obj.ctext3x, obj.key3x, obj.algo3x, encode);


console.log(obj)