@polkadot/wasm-crypto
Advanced tools
Comparing version 0.2.1 to 0.3.0-beta.0
@@ -10,3 +10,6 @@ // Copyright 2019 @polkadot/wasm-crypto authors & contributors | ||
export function blake2b (data: Uint8Array, key: Uint8Array, byteSize: number): Uint8Array; | ||
export function keccak256 (data: Uint8Array): Uint8Array; | ||
export function pbkdf2 (data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array; | ||
// export function secp256k1IsRecoverable (message: Uint8Array, signature: Uint8Array): number; | ||
// export function secp256k1Recover (message: Uint8Array, signature: Uint8Array): Uint8Array; | ||
export function sha512 (data: Uint8Array): Uint8Array; | ||
@@ -13,0 +16,0 @@ export function twox (data: Uint8Array, rounds: number): Uint8Array; |
@@ -12,3 +12,6 @@ // Copyright 2019 @polkadot/wasm-crypto authors & contributors | ||
module.exports.blake2b = stubbed.ext_blake2b; | ||
module.exports.keccak256 = stubbed.ext_keccak256; | ||
module.exports.pbkdf2 = stubbed.ext_pbkdf2; | ||
// module.exports.secp256k1IsRecoverable = stubbed.ext_secp256k1_is_recoverable; | ||
// module.exports.secp256k1Recover = stubbed.ext_secp256k1_recover; | ||
module.exports.sha512 = stubbed.ext_sha512; | ||
@@ -15,0 +18,0 @@ module.exports.twox = stubbed.ext_twox; |
{ | ||
"name": "@polkadot/wasm-crypto", | ||
"version": "0.2.1", | ||
"version": "0.3.0-beta.0", | ||
"author": "Jaco Greeff <jacogr@gmail.com>", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -50,3 +50,3 @@ /* tslint:disable */ | ||
* | ||
* Returns a vecor with the hash result | ||
* Returns a vector with the hash result | ||
* @param {Uint8Array} arg0 | ||
@@ -59,2 +59,11 @@ * @param {Uint8Array} arg1 | ||
/** | ||
* Create a keccak256 hash for the specified input | ||
* | ||
* | ||
* Returns the hash as a vector | ||
* @param {Uint8Array} arg0 | ||
* @returns {Uint8Array} | ||
*/ | ||
export function ext_keccak256(arg0: Uint8Array): Uint8Array; | ||
/** | ||
* pbkdf2 hash from an input, salt for the number of specified rounds | ||
@@ -61,0 +70,0 @@ * |
32
wasm.js
@@ -198,3 +198,3 @@ const crypto = require('crypto'); let wasm; const requires = { crypto }; | ||
* | ||
* Returns a vecor with the hash result | ||
* Returns a vector with the hash result | ||
* @param {Uint8Array} arg0 | ||
@@ -231,2 +231,32 @@ * @param {Uint8Array} arg1 | ||
/** | ||
* Create a keccak256 hash for the specified input | ||
* | ||
* | ||
* Returns the hash as a vector | ||
* @param {Uint8Array} arg0 | ||
* @returns {Uint8Array} | ||
*/ | ||
module.exports.ext_keccak256 = function(arg0) { | ||
const ptr0 = passArray8ToWasm(arg0); | ||
const len0 = WASM_VECTOR_LEN; | ||
const retptr = globalArgumentPtr(); | ||
try { | ||
wasm.ext_keccak256(retptr, ptr0, len0); | ||
const mem = getUint32Memory(); | ||
const rustptr = mem[retptr / 4]; | ||
const rustlen = mem[retptr / 4 + 1]; | ||
const realRet = getArrayU8FromWasm(rustptr, rustlen).slice(); | ||
wasm.__wbindgen_free(rustptr, rustlen * 1); | ||
return realRet; | ||
} finally { | ||
wasm.__wbindgen_free(ptr0, len0 * 1); | ||
} | ||
}; | ||
/** | ||
* pbkdf2 hash from an input, salt for the number of specified rounds | ||
@@ -233,0 +263,0 @@ * |
Sorry, the diff of this file is too big to display
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
233063
1322