ricmoo / aes-js

A pure JavaScript implementation of the AES block cipher and all common modes of operation for node.js or web browsers.
MIT License
1.45k stars 272 forks source link

Base64 encode/decode support #74

Closed chiro-hiro closed 6 years ago

chiro-hiro commented 6 years ago

Hex encoding is quite messy, it's always double the size of data.

I'm prefer to have:

//Return String
aesjs.utils.base64.encode(Uint8Array, encoding = 'utf8')

and

//Return Uint8Array
aesjs.utils.base64.decode(String, encoding = 'utf8')
ricmoo commented 6 years ago

The reason this is not currently offered is that those libraries are already quite common, and in many cases already available (node has Buffer, and the browser has btoa and atob).

I am planning a reactor of aes-js at some point in the near future, and they may be added then, of hex may be removed. I'm still debating over the correct API. The library may be broken into multiple files as well, one for the AES and one for utilities. I would like to keep the AES library as small as possible.

chiro-hiro commented 6 years ago

I would like to keep the AES library as small as possible.

I'd love this point. I'm writing an end-to-end encryption extension on browser, It's help me a lot.

Thank you,