forked from tornado-packages/noble-curves
Rename curves.
This commit is contained in:
parent
c660712fee
commit
4c6ca2326a
@ -45,8 +45,8 @@ npm install @noble/curves
|
|||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import shortw from '@noble/curves/shortw'; // Short Weierstrass curve
|
import weierstrass from '@noble/curves/weierstrass'; // Short Weierstrass curve
|
||||||
import twistede from '@noble/curves/twistede'; // Twisted Edwards curve
|
import twistedEdwards from '@noble/curves/edwards'; // Twisted Edwards curve
|
||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
import { hmac } from '@noble/hashes/hmac';
|
import { hmac } from '@noble/hashes/hmac';
|
||||||
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*! @noble/curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
/*! @noble/curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||||
import { weierstrass, CHash } from '@noble/curves/shortw';
|
import { weierstrass, CHash } from '@noble/curves/weierstrass';
|
||||||
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
||||||
import { hmac } from '@noble/hashes/hmac';
|
import { hmac } from '@noble/hashes/hmac';
|
||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { sha512 } from '@noble/hashes/sha512';
|
import { sha512 } from '@noble/hashes/sha512';
|
||||||
import { shake256 } from '@noble/hashes/sha3';
|
import { shake256 } from '@noble/hashes/sha3';
|
||||||
import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils';
|
import { concatBytes, randomBytes, utf8ToBytes, wrapConstructor } from '@noble/hashes/utils';
|
||||||
import { twistedEdwards } from '@noble/curves/twistede';
|
import { twistedEdwards } from '@noble/curves/edwards';
|
||||||
import { mod, pow2, isNegativeLE } from '@noble/curves/modular';
|
import { mod, pow2, isNegativeLE } from '@noble/curves/modular';
|
||||||
|
|
||||||
const ed25519P = BigInt(
|
const ed25519P = BigInt(
|
||||||
|
@ -3,7 +3,7 @@ import { hmac } from '@noble/hashes/hmac';
|
|||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
import { sha384, sha512 } from '@noble/hashes/sha512';
|
import { sha384, sha512 } from '@noble/hashes/sha512';
|
||||||
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
||||||
import { weierstrass, CurveType, CHash } from '@noble/curves/shortw';
|
import { weierstrass, CurveType, CHash } from '@noble/curves/weierstrass';
|
||||||
import { mod, pow2 } from '@noble/curves/modular';
|
import { mod, pow2 } from '@noble/curves/modular';
|
||||||
|
|
||||||
// TODO: ability to provide API for different default hash.
|
// TODO: ability to provide API for different default hash.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { hmac } from '@noble/hashes/hmac';
|
import { hmac } from '@noble/hashes/hmac';
|
||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
||||||
import { weierstrass, CHash } from '@noble/curves/shortw';
|
import { weierstrass, CHash } from '@noble/curves/weierstrass';
|
||||||
|
|
||||||
function getHash(hash: CHash) {
|
function getHash(hash: CHash) {
|
||||||
return {
|
return {
|
||||||
|
@ -3,7 +3,7 @@ import { keccak_256 } from '@noble/hashes/sha3';
|
|||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
import { hmac } from '@noble/hashes/hmac';
|
import { hmac } from '@noble/hashes/hmac';
|
||||||
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
import { concatBytes, randomBytes } from '@noble/hashes/utils';
|
||||||
import { weierstrass, CHash, JacobianPointType } from '@noble/curves/shortw';
|
import { weierstrass, CHash, JacobianPointType } from '@noble/curves/weierstrass';
|
||||||
import * as cutils from '@noble/curves/utils';
|
import * as cutils from '@noble/curves/utils';
|
||||||
|
|
||||||
function getHash(hash: CHash) {
|
function getHash(hash: CHash) {
|
||||||
|
16
package.json
16
package.json
@ -37,15 +37,15 @@
|
|||||||
"import": "./lib/esm/modular.js",
|
"import": "./lib/esm/modular.js",
|
||||||
"default": "./lib/modular.js"
|
"default": "./lib/modular.js"
|
||||||
},
|
},
|
||||||
"./shortw": {
|
"./weierstrass": {
|
||||||
"types": "./lib/shortw.d.ts",
|
"types": "./lib/weierstrass.d.ts",
|
||||||
"import": "./lib/esm/shortw.js",
|
"import": "./lib/esm/weierstrass.js",
|
||||||
"default": "./lib/shortw.js"
|
"default": "./lib/weierstrass.js"
|
||||||
},
|
},
|
||||||
"./twistede": {
|
"./edwards": {
|
||||||
"types": "./lib/twistede.d.ts",
|
"types": "./lib/edwards.d.ts",
|
||||||
"import": "./lib/esm/twistede.js",
|
"import": "./lib/esm/edwards.js",
|
||||||
"default": "./lib/twistede.js"
|
"default": "./lib/edwards.js"
|
||||||
},
|
},
|
||||||
"./utils": {
|
"./utils": {
|
||||||
"types": "./lib/utils.d.ts",
|
"types": "./lib/utils.d.ts",
|
||||||
|
Loading…
Reference in New Issue
Block a user