0.0.0-alpha.0 • Published 4 years ago

aes-ts v0.0.0-alpha.0

Weekly downloads
83
License
MIT
Repository
github
Last release
4 years ago

AES-TS

test status npm version zero dependencies MIT License

a modern port of AES-JS:

A pure JavaScript implementation of the AES block cipher algorithm and all common modes of operation (CBC, CFB, CTR, ECB and OFB).

for proper documentation please check their README.md.

motivation

best practices

  • don't roll your own crypto, especially don't touch Block directly.
  • don't use ECB. don't reuse IVs.
  • don't use this library, use SubtleCrypto, whenever possible.

exports

ESM exports, listed by Common Mode Of Operation.

*EncryptorDecryptor
BlockEncryptorDecryptor
CBCCBCEncryptorCBCDecryptor
CFBCFBEncryptorCFBDecryptor
CTRCTREncryptorCTRDecryptor
ECBECBEncryptorECBDecryptor
OFBOFBEncryptorOFBDecryptor

interfaces

replace ___ for the mode of operation.

each mode has unique parameters, described by their types.

Encryptor

const encryptor = new ___Encryptor(key)
const ciphertext = encryptor.encrypt(plaintext)

Decryptor

const decryptor = new ___Decryptor(key)
const plaintext = decryptor.decrypt(ciphertext)

Encryptor + Decryptor

const mode = new ___(key)
const sametext = mode.decrypt(mode.encrypt(plaintext))

license and acknowledgments

MIT

all crypto code and tests were taken directly from AES-JS, written by @ricmoo.