CryptoJS Examples

CryptoJS was created by Jeff Mott in 2009.

Hashes

Hash functions can encrypt text, but hashes cannot be decrypted. They are useful for encrypting passwords and authenticating messages.

The CryptoJS hash functions return WordArray objects.

MD5

MD5 is a popular hash, but is no longer considered secure.

SHA-1

SHA-2

SHA-2 is a set of hash algorithms.

SHA-256

SHA-512

SHA-3

SHA-3 can output hash lengths of 224, 256, 384, or 512 bits. The default is 512 bits.

RIPEMD

CryptoJS provides a RIPEMD-160 function which is used in Bitcoin.

Ciphers

Ciphers can encrypt and decrypt data.

DES

The Data Encryption Standard was developed by IBM in the early 1970's and was adopted by the Federal Information Processing Standard (FIPS) in 1977. It is now considered insecure, but the TripleDES function is still considered secure.

AES

The Advanced Encryption Standard is based on Rijndael. Adopted by NIST in 2001.

Rabbit

Stream cipher introduced in 2003.

RC4

Rivest Cipher 4. Designed in 1987 and leaked in 1994. While insecure, its speed and simplicity led to wide adoption. It is utilized in SSL, WEP and TLS protocols.