TweetNaCl.js is a port of TweetNaCl / NaCl to JavaScript. It implements secret-key authenticated encryption, public-key authenticated encryption, hashing, and public-key signatures. High-level crypto library in only 7 KB (minified and gzipped)!

Download Documentation Source on GitHub

Secretbox: secret-key authenticated encryption

Encrypt and decrypt messages with a secret key.

Based on XSalsa20 stream cipher and Poly1305 one-time authenticator.

Try secretbox »

Box: public-key authenticated Encryption

Encrypt and decrypt messages between sender and receiver using elliptic curve Diffie-Hellman key exchange.

Based on Curve25519-XSalsa20-Poly1305.

Try box »

Public-key signatures

Sign messages with a secret key, and verify signatures.

Public keys are only 32 bytes, signatures are 64 bytes long.

Implements Ed25519.

Try signatures »


Hash messages with SHA-512.

Try hashing »


npm install tweetnacl

bower install tweetnacl

or download source