Support byte array and ArrayBuffer input.

This commit is contained in:
Chen Yi-Cyuan
2015-05-21 19:28:19 +08:00
parent db3ab779a8
commit 7851f7ad68
9 changed files with 200 additions and 129 deletions
+14
View File
@@ -157,6 +157,20 @@ keccak_256('中文');
keccak_224('中文');
// f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd
```
It also supports byte `Array`, `Uint8Array`, `ArrayBuffer` input:
Code
```JavaScript
sha3_512([]);
// a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26
sha3_512(new Uint8Array([]));
// a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26
// ...
```
## Benchmark
[UTF8](http://jsperf.com/sha3/5)
[ASCII](http://jsperf.com/sha3/4)