Skip to content

Fast and slim Javascript implementation of AES in ECB and CTR modes

License

Notifications You must be signed in to change notification settings

louismullie/aes-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##aes-js

A fast and super-slim Javascript implementation of AES in ECB and CTR modes.

###Warning

If you are looking for a generic AES encryption library, this is probably not what you are looking for. If you do not have a good reason for using ECB or CTR, or if you don't know what that means, do not use this library. Instead, use the SJCL library and the AES-CCM mode of operation.

###Features

  • Based on well-reviewed AES implementation (SJCL).
  • Uses 32-bit words internally for maximal JS performance.
  • CTR mode compatible with OpenSSL and NIST test vectors.
  • Extremely portable (230 loc, 3 kb compressed).
  • Provides helpers to convert string to bytes and back.

###Usage

ECB mode

var key = AES.Codec.strToWords("a non secret key"),
    block = AES.Codec.strToWords("a non secret msg");

cipher = new AES.ECB(key);

cipher.encrypt(block);

CTR mode

var key = AES.Codec.strToWords("a non secret key"),
    iv = AES.Codec.strToWords("a non secret iv"),
    block = AES.Codec.strToWords("a non secret msg");

cipher = new AES.CTR(key, iv);

cipher.encrypt(block);

###License

This code is licensed under the BSD license. Most of the code comes from the SJCL implementation of AES, which is (c) Emily Stark, Mike Hamburg, Dan Boneh, Stanford University 2008-2010 and BSD-licensed.

About

Fast and slim Javascript implementation of AES in ECB and CTR modes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published