Socket
Socket
Sign inDemoInstall

aes

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aes

A JavaScript component for the Advanced Encryption Standard (AES).


Version published
Weekly downloads
1.8K
decreased by-3.94%
Maintainers
1
Install size
8.98 kB
Created
Weekly downloads
 

Readme

Source

aes

A JavaScript component for the Advanced Encryption Standard (AES). Fully compatible with Node.js and the browser (via Browserify).

(Note, more optimizations may need to be made)

Why?

AES is currently one of the most popular block ciper encyrption algorithms. It is relevant to the Bitcoin private key encryption scheme BIP38.

Usage

Installation

npm install --save aes

Example

Note, that as version 0.1.x, you must be concerned with the endianess of your input data. It expects that the key is a regular JavaScript array of 4,6,8 or 32-bit unsigned values. The encrypt function is a regular JavaScript array of 4 32-bit big endian unsigned integers.

var AES = require('aes')

var key = [0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xfffffff8];
var pt = [0x00000000,0x00000000,0x00000000,0x00000000];
var ct = [0xd241aab0,0x5a42d319,0xde81d874,0xf5c7b90d];

var aes = new AES(key);
console.dir(aes.encrypt(pt)); // => [0xd241aab0,0x5a42d319,0xde81d874,0xf5c7b90d]
console.dir(aes.decrypt(ct)); // => [0x00000000,0x00000000,0x00000000,0x00000000]

Testing

  1. Clone the git repo.
  2. npm install --development
Node.js
Make node-test
Browser
npm install --production selenium-standalone -g start-selenium

(source your shell or open a new one), edit file .min-wd

start-selenium
Make browser-test

Bundle for Browser

npm install -g browserify
browserify < lib/aes.js > lib/aes.bundle.js

References

Credits

Extracted from the Stanford JavaScript Crypto Library.

License

BSD License

Keywords

FAQs

Last updated on 22 Feb 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc