ripemd160-min
Advanced tools
Comparing version 0.0.5 to 0.0.6
export declare type ByteArray = number[] | Uint8Array; | ||
export default class RIPEMD160 { | ||
export declare class RIPEMD160 { | ||
private _block; | ||
@@ -18,2 +18,3 @@ private _blockSize; | ||
} | ||
export default RIPEMD160; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const ARRAY16 = new Array(16); | ||
const zl = [ | ||
const zl = initU8Array([ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
@@ -12,4 +12,4 @@ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | ||
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 | ||
]; | ||
const zr = [ | ||
]); | ||
const zr = initU8Array([ | ||
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | ||
@@ -20,4 +20,4 @@ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | ||
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 | ||
]; | ||
const sl = [ | ||
]); | ||
const sl = initU8Array([ | ||
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | ||
@@ -28,4 +28,4 @@ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | ||
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 | ||
]; | ||
const sr = [ | ||
]); | ||
const sr = initU8Array([ | ||
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | ||
@@ -36,5 +36,5 @@ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | ||
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 | ||
]; | ||
const hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]; | ||
const hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]; | ||
]); | ||
const hl = initU32Array([0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]); | ||
const hr = initU32Array([0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]); | ||
function rotl(x, n) { | ||
@@ -83,4 +83,20 @@ return (x << n) | (x >>> (32 - n)); | ||
} | ||
function createArray(size) { | ||
function initU32Array(data) { | ||
if (typeof Uint32Array !== 'undefined') { | ||
return new Uint32Array(data); | ||
} | ||
else { | ||
return data; | ||
} | ||
} | ||
function initU8Array(data) { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(data); | ||
} | ||
else { | ||
return data; | ||
} | ||
} | ||
function createU8Array(size) { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(size); | ||
@@ -94,3 +110,3 @@ } | ||
constructor() { | ||
this._block = createArray(64); | ||
this._block = createU8Array(64); | ||
this._blockSize = 64; | ||
@@ -204,3 +220,3 @@ this._blockOffset = 0; | ||
// produce result | ||
const buffer = createArray(20); | ||
const buffer = createU8Array(20); | ||
writeInt32LE(buffer, this._a, 0); | ||
@@ -220,2 +236,3 @@ writeInt32LE(buffer, this._b, 4); | ||
} | ||
exports.RIPEMD160 = RIPEMD160; | ||
exports.default = RIPEMD160; |
export declare type ByteArray = number[] | Uint8Array; | ||
export default class RIPEMD160 { | ||
export declare class RIPEMD160 { | ||
private _block; | ||
@@ -18,2 +18,3 @@ private _blockSize; | ||
} | ||
export default RIPEMD160; | ||
//# sourceMappingURL=index.d.ts.map |
// Extracted from https://github.com/crypto-browserify/ripemd160 | ||
const ARRAY16 = new Array(16); | ||
const zl = [ | ||
const zl = initU8Array([ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
@@ -9,4 +9,4 @@ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | ||
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 | ||
]; | ||
const zr = [ | ||
]); | ||
const zr = initU8Array([ | ||
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | ||
@@ -17,4 +17,4 @@ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | ||
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 | ||
]; | ||
const sl = [ | ||
]); | ||
const sl = initU8Array([ | ||
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | ||
@@ -25,4 +25,4 @@ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | ||
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 | ||
]; | ||
const sr = [ | ||
]); | ||
const sr = initU8Array([ | ||
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | ||
@@ -33,5 +33,5 @@ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | ||
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 | ||
]; | ||
const hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]; | ||
const hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]; | ||
]); | ||
const hl = initU32Array([0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]); | ||
const hr = initU32Array([0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]); | ||
function rotl(x, n) { | ||
@@ -80,4 +80,20 @@ return (x << n) | (x >>> (32 - n)); | ||
} | ||
function createArray(size) { | ||
function initU32Array(data) { | ||
if (typeof Uint32Array !== 'undefined') { | ||
return new Uint32Array(data); | ||
} | ||
else { | ||
return data; | ||
} | ||
} | ||
function initU8Array(data) { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(data); | ||
} | ||
else { | ||
return data; | ||
} | ||
} | ||
function createU8Array(size) { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(size); | ||
@@ -89,5 +105,5 @@ } | ||
} | ||
export default class RIPEMD160 { | ||
export class RIPEMD160 { | ||
constructor() { | ||
this._block = createArray(64); | ||
this._block = createU8Array(64); | ||
this._blockSize = 64; | ||
@@ -201,3 +217,3 @@ this._blockOffset = 0; | ||
// produce result | ||
const buffer = createArray(20); | ||
const buffer = createU8Array(20); | ||
writeInt32LE(buffer, this._a, 0); | ||
@@ -217,1 +233,2 @@ writeInt32LE(buffer, this._b, 4); | ||
} | ||
export default RIPEMD160; |
export declare type ByteArray = number[] | Uint8Array; | ||
export default class RIPEMD160 { | ||
export declare class RIPEMD160 { | ||
private _block; | ||
@@ -18,2 +18,3 @@ private _blockSize; | ||
} | ||
export default RIPEMD160; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -14,3 +14,3 @@ // Extracted from https://github.com/crypto-browserify/ripemd160 | ||
var ARRAY16 = new Array(16); | ||
var zl = [ | ||
var zl = initU8Array([ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
@@ -21,4 +21,4 @@ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | ||
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 | ||
]; | ||
var zr = [ | ||
]); | ||
var zr = initU8Array([ | ||
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | ||
@@ -29,4 +29,4 @@ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | ||
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 | ||
]; | ||
var sl = [ | ||
]); | ||
var sl = initU8Array([ | ||
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | ||
@@ -37,4 +37,4 @@ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | ||
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 | ||
]; | ||
var sr = [ | ||
]); | ||
var sr = initU8Array([ | ||
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | ||
@@ -45,5 +45,5 @@ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | ||
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 | ||
]; | ||
var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]; | ||
var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]; | ||
]); | ||
var hl = initU32Array([0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]); | ||
var hr = initU32Array([0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]); | ||
function rotl(x, n) { | ||
@@ -92,4 +92,20 @@ return (x << n) | (x >>> (32 - n)); | ||
} | ||
function createArray(size) { | ||
function initU32Array(data) { | ||
if (typeof Uint32Array !== 'undefined') { | ||
return new Uint32Array(data); | ||
} | ||
else { | ||
return data; | ||
} | ||
} | ||
function initU8Array(data) { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(data); | ||
} | ||
else { | ||
return data; | ||
} | ||
} | ||
function createU8Array(size) { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(size); | ||
@@ -103,3 +119,3 @@ } | ||
function RIPEMD160() { | ||
this._block = createArray(64); | ||
this._block = createU8Array(64); | ||
this._blockSize = 64; | ||
@@ -213,3 +229,3 @@ this._blockOffset = 0; | ||
// produce result | ||
var buffer = createArray(20); | ||
var buffer = createU8Array(20); | ||
writeInt32LE(buffer, this._a, 0); | ||
@@ -230,3 +246,4 @@ writeInt32LE(buffer, this._b, 4); | ||
}()); | ||
exports.RIPEMD160 = RIPEMD160; | ||
exports.default = RIPEMD160; | ||
}); |
{ | ||
"name": "ripemd160-min", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A minimal 0 dependency RIPEMD160 hash lib", | ||
@@ -29,15 +29,15 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/chai": "^4.2.2", | ||
"@types/chai": "^4.2.6", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^10.14.20", | ||
"@types/node": "^12.12.14", | ||
"chai": "^4.2.0", | ||
"cross-env": "^5.2.1", | ||
"cross-env": "^6.0.3", | ||
"hash-test-vectors": "^1.3.2", | ||
"mocha": "^6.2.0", | ||
"mocha": "^6.2.2", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^14.1.1", | ||
"shx": "^0.3.2", | ||
"source-map-support": "^0.5.13", | ||
"ts-node": "^8.4.1", | ||
"typescript": "^3.6.3" | ||
"source-map-support": "^0.5.16", | ||
"ts-node": "^8.5.4", | ||
"typescript": "^3.7.3" | ||
}, | ||
@@ -44,0 +44,0 @@ "repository": { |
@@ -5,3 +5,3 @@ // Extracted from https://github.com/crypto-browserify/ripemd160 | ||
const zl = [ | ||
const zl = initU8Array([ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
@@ -12,5 +12,5 @@ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, | ||
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 | ||
] | ||
]) | ||
const zr = [ | ||
const zr = initU8Array([ | ||
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, | ||
@@ -21,5 +21,5 @@ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, | ||
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 | ||
] | ||
]) | ||
const sl = [ | ||
const sl = initU8Array([ | ||
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, | ||
@@ -30,5 +30,5 @@ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, | ||
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 | ||
] | ||
]) | ||
const sr = [ | ||
const sr = initU8Array([ | ||
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, | ||
@@ -39,6 +39,6 @@ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, | ||
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 | ||
] | ||
]) | ||
const hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e] | ||
const hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000] | ||
const hl = initU32Array([0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]) | ||
const hr = initU32Array([0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]) | ||
@@ -107,4 +107,20 @@ function rotl(x: number, n: number): number { | ||
function createArray(size: number): ByteArray { | ||
function initU32Array(data: number[]): U32Array { | ||
if (typeof Uint32Array !== 'undefined') { | ||
return new Uint32Array(data) | ||
} else { | ||
return data | ||
} | ||
} | ||
function initU8Array(data: number[]): ByteArray { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(data) | ||
} else { | ||
return data | ||
} | ||
} | ||
function createU8Array(size: number): ByteArray { | ||
if (typeof Uint8Array !== 'undefined') { | ||
return new Uint8Array(size) | ||
@@ -118,3 +134,5 @@ } else { | ||
export default class RIPEMD160 { | ||
type U32Array = number[] | Uint32Array | ||
export class RIPEMD160 { | ||
private _block: ByteArray; | ||
@@ -141,3 +159,3 @@ | ||
constructor() { | ||
this._block = createArray(64) | ||
this._block = createU8Array(64) | ||
this._blockSize = 64 | ||
@@ -260,3 +278,3 @@ this._blockOffset = 0 | ||
// produce result | ||
const buffer = createArray(20) | ||
const buffer = createU8Array(20) | ||
writeInt32LE(buffer, this._a, 0) | ||
@@ -280,1 +298,3 @@ writeInt32LE(buffer, this._b, 4) | ||
} | ||
export default RIPEMD160 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38927
1000