alex-zhang / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

Add possibility to access the processed data as DataView/ArrayBuffer #64

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm glad to see that you implemented the creation of WordArray objects with 
typed Arrays as input parameter.

I think there should be a possibility to access the (processed) data contained 
in a WordArray as a typed Array/DataView/ArrayBuffer, too.
So you could save bandwidth when sending larger amounts of data that have been 
processed by CryptoJS by simply sending the binary data instead of a string 
which contains Base64 encoded data.

The conversion between the word array and the ArrayBuffer might not be that 
performant, but i like it better than  handling huge strings and blowing the 
input data at almost 1 1/2 of the original size.

Original issue reported on code.google.com by fc.kl...@googlemail.com on 17 Jan 2013 at 11:26

GoogleCodeExporter commented 8 years ago
I could add methods such as wordArray.toDataView() or 
wordArray.toArrayBuffer(). Is that what you're looking for? Unfortunately this 
library cannot internally rely on typed arrays because they're not 
cross-browser compatible.

Original comment by Jeff.Mott.OR on 18 Jan 2013 at 12:58

GoogleCodeExporter commented 8 years ago
That is exactly what I'm looking for.

I understand that you don't want to handle the data internally as typed array 
due to the cross-browser compatibility but it would be nice to have at least an 
interface where you can fetch the data as ArrayBuffer object instead of a 
string.

Original comment by fc.kl...@googlemail.com on 18 Jan 2013 at 12:57

GoogleCodeExporter commented 8 years ago
I'd also find something like wordArray.toArrayBuffer() *super* useful. 

Original comment by sara.bai...@gmail.com on 28 Jan 2013 at 11:41