Files
common/packages/util-crypto/test/performance.ts
T
Jaco 303a57c4b5 Use secp256k1 from wasm (#1276)
* Use secp256k1 from wasm

* Expand & recover

* sign (tests failing)

* Pass onlyJs flags everywhere

* Adjust, all ready to actually pass... they don't

* naming

* Fix verify tests

* Adjust verify with non-hashing

* bump wasm

* Allow verify against address or publicKey

* Passing tests

* comment for wasm

* bi/bn versions for tweakadd

* Bumps

* Adjust
2021-12-03 16:23:41 +02:00

18 lines
633 B
TypeScript

// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { arrayRange } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
import { performance, performanceCmp } from '../../util/test/performance';
type ExecFn = (input: Uint8Array, onlyJs: boolean) => unknown;
const GENERATED = arrayRange(256).map(() => [randomAsU8a()]);
export function performanceWasm (name: string, count: number, exec: ExecFn, inputs = GENERATED): void {
performanceCmp(name, ['WebAssembly', 'JavaScript'], count, inputs, exec);
}
export { performance, performanceCmp };