mirror of
https://github.com/emn178/js-sha3.git
synced 2026-08-12 19:41:36 +08:00
add shake algorithm
This commit is contained in:
+15
-9
@@ -1,13 +1,13 @@
|
||||
ArrayBuffer.prototype.toHexString = function (argument) {
|
||||
var array = new Uint8Array(this);
|
||||
var hex = '';
|
||||
for(var i = 0;i < array.length;++i) {
|
||||
var c = array[i].toString('16');
|
||||
hex += c.length == 1 ? '0' + c : c;
|
||||
}
|
||||
return hex;
|
||||
};
|
||||
(function(sha3_512, sha3_384, sha3_256, sha3_224) {
|
||||
ArrayBuffer.prototype.toHexString = function (argument) {
|
||||
var array = new Uint8Array(this);
|
||||
var hex = '';
|
||||
for(var i = 0;i < array.length;++i) {
|
||||
var c = array[i].toString('16');
|
||||
hex += c.length == 1 ? '0' + c : c;
|
||||
}
|
||||
return hex;
|
||||
};
|
||||
describe('sha3_512', function() {
|
||||
context('when ascii', function() {
|
||||
context('and less than 128 bytes', function() {
|
||||
@@ -74,6 +74,12 @@ ArrayBuffer.prototype.toHexString = function (argument) {
|
||||
expect(sha3_512.buffer('').toHexString()).to.be('a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26');
|
||||
});
|
||||
});
|
||||
|
||||
context('#hex', function() {
|
||||
it('should be equal', function() {
|
||||
expect(sha3_512.hex('')).to.be(sha3_512(''));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('sha3_384', function() {
|
||||
|
||||
Reference in New Issue
Block a user