Skip to content

Commit

Permalink
Update hashes to v1.5, test on nodejs v14, improve h2c checks
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Sep 1, 2024
1 parent 5e69a3b commit b69a8bb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
strategy:
matrix:
node:
- 14
- 16
- 18
- 20
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ Audited & minimal JS implementation of elliptic curve cryptography.
- 🧜‍♂️ Poseidon ZK-friendly hash
- 🪶 178KB (87KB gzipped) for everything including bundled hashes, 22KB (10KB gzipped) for single-curve build

For discussions, questions and support, visit
[GitHub Discussions](https://github.com/paulmillr/noble-curves/discussions)
section of the repository.
Take a glance at [GitHub Discussions](https://github.com/paulmillr/noble-curves/discussions) for questions and support.

### This library belongs to _noble_ cryptography

Expand Down Expand Up @@ -45,7 +43,7 @@ A standalone file [noble-curves.js](https://github.com/paulmillr/noble-curves/re
```js
// import * from '@noble/curves'; // Error: use sub-imports, to ensure small app size
import { secp256k1 } from '@noble/curves/secp256k1'; // ESM and Common.js
// import { secp256k1 } from 'npm:@noble/curves@1.4.0/secp256k1'; // Deno
// import { secp256k1 } from 'npm:@noble/curves@1.6.0/secp256k1'; // Deno
```

- [Implementations](#implementations)
Expand Down
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"license": "MIT",
"dependencies": {
"@noble/hashes": "1.4.0"
"@noble/hashes": "1.5.0"
},
"devDependencies": {
"@paulmillr/jsbt": "0.2.1",
Expand Down
3 changes: 1 addition & 2 deletions src/abstract/hash-to-curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ export function expand_message_xmd(
if (DST.length > 255) DST = H(concatBytes(utf8ToBytes('H2C-OVERSIZE-DST-'), DST));
const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;
const ell = Math.ceil(lenInBytes / b_in_bytes);
if (lenInBytes > 65535 || ell > 255)
throw new Error('expand_message_xmd: invalid lenInBytes');
if (lenInBytes > 65535 || ell > 255) throw new Error('expand_message_xmd: invalid lenInBytes');
const DST_prime = concatBytes(DST, i2osp(DST.length, 1));
const Z_pad = i2osp(0, r_in_bytes);
const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str
Expand Down

0 comments on commit b69a8bb

Please sign in to comment.