Upstream @noble packages (#1319)
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import { blake2b as blake2bJs } from '@noble/hashes/lib/blake2b';
|
||||
|
||||
import { hasBigInt, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2b, isReady } from '@polkadot/wasm-crypto';
|
||||
import { blake2b as blake2bJs } from '@polkadot/x-noble-hashes/blake2b';
|
||||
|
||||
import { createAsHex } from '../helpers';
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
import '@polkadot/x-bigint/shim';
|
||||
|
||||
import { utils as utilsNobleSecp256k1 } from '@noble/secp256k1';
|
||||
|
||||
import { u8aConcat } from '@polkadot/util';
|
||||
import { utils as utilsNobleSecp256k1 } from '@polkadot/x-noble-secp256k1';
|
||||
|
||||
import { cryptoWaitReady } from './crypto';
|
||||
import { hmacSha256AsU8a } from './hmac';
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { hmac } from '@noble/hashes/lib/hmac';
|
||||
import { sha256 } from '@noble/hashes/lib/sha256';
|
||||
import { sha512 } from '@noble/hashes/lib/sha512';
|
||||
|
||||
import { hasBigInt, u8aToU8a } from '@polkadot/util';
|
||||
import { hmacSha256, hmacSha512, isReady } from '@polkadot/wasm-crypto';
|
||||
import { hmac } from '@polkadot/x-noble-hashes/hmac';
|
||||
import { sha256 } from '@polkadot/x-noble-hashes/sha256';
|
||||
import { sha512 } from '@polkadot/x-noble-hashes/sha512';
|
||||
|
||||
type BitLength = 256 | 512;
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { keccak_256 as keccak256Js, keccak_512 as keccak512Js } from '@noble/hashes/lib/sha3';
|
||||
|
||||
import { keccak256, keccak512 } from '@polkadot/wasm-crypto';
|
||||
import { keccak_256 as keccak256Js, keccak_512 as keccak512Js } from '@polkadot/x-noble-hashes/sha3';
|
||||
|
||||
import { createAsHex, createBitHasher, createDualHasher } from '../helpers';
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
|
||||
import { pbkdf2 as pbkdf2Js } from '@noble/hashes/lib/pbkdf2';
|
||||
import { sha512 } from '@noble/hashes/lib/sha512';
|
||||
|
||||
import { hasBigInt, u8aToU8a } from '@polkadot/util';
|
||||
import { isReady, pbkdf2 } from '@polkadot/wasm-crypto';
|
||||
import { pbkdf2 as pbkdf2Js } from '@polkadot/x-noble-hashes/pbkdf2';
|
||||
import { sha512 } from '@polkadot/x-noble-hashes/sha512';
|
||||
|
||||
import { randomAsU8a } from '../random/asU8a';
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Params } from './types';
|
||||
|
||||
import { scrypt as scryptJs } from '@noble/hashes/lib/scrypt';
|
||||
|
||||
import { hasBigInt, objectSpread, u8aToU8a } from '@polkadot/util';
|
||||
import { isReady, scrypt } from '@polkadot/wasm-crypto';
|
||||
import { scrypt as scryptJs } from '@polkadot/x-noble-hashes/scrypt';
|
||||
|
||||
import { randomAsU8a } from '../random/asU8a';
|
||||
import { DEFAULT_PARAMS } from './defaults';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Point } from '@noble/secp256k1';
|
||||
|
||||
import { assert, hasBigInt } from '@polkadot/util';
|
||||
import { isReady, secp256k1Compress as wasm } from '@polkadot/wasm-crypto';
|
||||
import { Point } from '@polkadot/x-noble-secp256k1';
|
||||
|
||||
export function secp256k1Compress (publicKey: Uint8Array, onlyJs?: boolean): Uint8Array {
|
||||
if (publicKey.length === 33) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { Point } from '@noble/secp256k1';
|
||||
|
||||
import { assert, bnToU8a, hasBigInt, u8aConcat } from '@polkadot/util';
|
||||
import { isReady, secp256k1Expand as wasm } from '@polkadot/wasm-crypto';
|
||||
import { Point } from '@polkadot/x-noble-secp256k1';
|
||||
|
||||
import { BN_BE_256_OPTS } from '../bn';
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
import type { Keypair } from '../../types';
|
||||
|
||||
import { getPublicKey } from '@noble/secp256k1';
|
||||
|
||||
import { assert, hasBigInt } from '@polkadot/util';
|
||||
import { isReady, secp256k1FromSeed } from '@polkadot/wasm-crypto';
|
||||
import { getPublicKey } from '@polkadot/x-noble-secp256k1';
|
||||
|
||||
/**
|
||||
* @name secp256k1PairFromSeed
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { HashType } from './types';
|
||||
|
||||
import { recoverPublicKey, Signature } from '@noble/secp256k1';
|
||||
|
||||
import { assert, hasBigInt, u8aToU8a } from '@polkadot/util';
|
||||
import { isReady, secp256k1Recover as wasm } from '@polkadot/wasm-crypto';
|
||||
import { recoverPublicKey, Signature } from '@polkadot/x-noble-secp256k1';
|
||||
|
||||
import { secp256k1Compress } from './compress';
|
||||
import { secp256k1Expand } from './expand';
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
import type { Keypair } from '../types';
|
||||
import type { HashType } from './types';
|
||||
|
||||
import { Signature, signSync } from '@noble/secp256k1';
|
||||
|
||||
import { assert, bnToU8a, hasBigInt, u8aConcat } from '@polkadot/util';
|
||||
import { isReady, secp256k1Sign as wasm } from '@polkadot/wasm-crypto';
|
||||
import { Signature, signSync } from '@polkadot/x-noble-secp256k1';
|
||||
|
||||
import { BN_BE_256_OPTS } from '../bn';
|
||||
import { hasher } from './hasher';
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { sha256 as sha256Js } from '@noble/hashes/lib/sha256';
|
||||
import { sha512 as sha512Js } from '@noble/hashes/lib/sha512';
|
||||
|
||||
import { sha256, sha512 } from '@polkadot/wasm-crypto';
|
||||
import { sha256 as sha256Js } from '@polkadot/x-noble-hashes/sha256';
|
||||
import { sha512 as sha512Js } from '@polkadot/x-noble-hashes/sha512';
|
||||
|
||||
import { createBitHasher, createDualHasher } from '../helpers';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user