Git Product home page Git Product logo

cription's Introduction

======= CRIPTION

Javascript AES Encryption Library. Encrypt and Decrypt messages using an Encryption Key. Based on the implementation of the AES block cipher @: http://point-at-infinity.org/jsaes/

Cription

The cription object provides access to the methods.

Methods

##Cription.encrypt(...) Encrypts a secret with a key.

var cription = new Cription();
var options = {
	secret : 	"mySecret",						
	key :		"myEncryptionKey1", 			
	store : 	false							
};
var encrypted_secret = cription.encrypt(options);

###Parameters

  • secret: The string that is encrypted.
  • key: (Optional) The key that encrypts the secret.
  • store: (Optional) The option to save key myKey to localStorage('key'). Default == false

###Description If a key is not provided/valid an automatically generated key will be used. Keys must be [16,24,32] chars in length and hexadecimal If options.store == true then localStorage.key == options.key.

##Cription.decrypt(...) Decrypts an encrypted secret with a key.

var options = {
	secret : 	encrypted_secret,
	key : 		"myEncryptionKey1",				
};
var decrypted_secret = cription.decrypt(options);

###Parameters

  • secret: The encrypted secret.
  • key: (Optional) The key that decrypts the secret.

###Description If a key is not provided/valid then the key saved in localStorage will be used.

##Cription.generateKey(...) Creates a random, valid key.

var myKey = myCription.generateKey(n);

###Parameters

  • n: number of characters. n=[16,24,32];

###Description Use this if a random, non-customized password is required. If n is not one of 16, 24 or 32 an error is thrown.

Example

var myCription = new Cription();
var encrypted_secret = myCription.encrypt({secret:"mySecret", store:true});	
//Generates a random key and stores it to "localStorage.key". 
//Auto-generated keys will print to console.log on encryption.
var decrypted_secret = myCription.decrypt({secret:encrypted_secret});		
//decrypts the encrypted secret with key stored in "localStorage.key"
console.log(decrypted_secret);//"mySecret"

Example: http://cs1.ucc.ie/~jdp2/cription/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.