Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Sep 9, 2024
1 parent bdaf6fa commit 89d8a1e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
17 changes: 16 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ module.exports = {
...spellcheckerRule,
cspell: {
...cspellConfig,
ignoreWords: ['dtau', 'escalar', 'pleft', 'pright']
ignoreWords: [
'dtau',
'escalar',
'pleft',
'pright',
'unstringify',
'bxor',
'nullt',
'msglen',
'negone',
'tonelli',
'nres',
'idiv',
'newr',
'bnot'
]
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"build:esm": "tsc -p config/tsconfig.esm.json",
"clean": "rimraf ./dist",
"test": "jest",
"lint": "eslint --fix --ext .ts src/** tests/**",
"lint:check": "eslint --ext .ts src/** tests/**",
"lint": "eslint --fix --ext .js,.ts src/** tests/**",
"lint:check": "eslint --ext .js,.ts src/** tests/**",
"format": "prettier --config .prettierrc './**/*.ts' --write",
"format:check": "prettier --config .prettierrc './**/*.ts' --check"
},
Expand Down
6 changes: 3 additions & 3 deletions src/ff/f1field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ export class F1Field {
return this.toRprLE(buff, o, this.mul(this.R, e));
}

// Pases a buffer with Little Endian Representation
// Passes a buffer with Little Endian Representation
fromRprLE(buff: Uint8Array, o: number) {
return Scalar.fromRprLE(buff, o, this.n8);
}

// Pases a buffer with Big Endian Representation
// Passes a buffer with Big Endian Representation
fromRprBE(buff: Uint8Array, o: number) {
return Scalar.fromRprBE(buff, o, this.n8);
}
Expand Down Expand Up @@ -425,7 +425,7 @@ export function mulScalar(F: F1Field, base: bigint, e: bigint): bigint {
} else if (n[n.length - 1] == -1) {
res = F.neg(base);
} else {
throw new Error('invlaud NAF');
throw new Error('invalid NAF');
}

for (let i = n.length - 2; i >= 0; i--) {
Expand Down
4 changes: 2 additions & 2 deletions src/ff/scalar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const toRprBE = (buff: Uint8Array, o: number, e: bigint, n8: number): voi
for (let i = 0; i < n8 / 4 - l; i++) v.setInt32(0, 0, false);
};

// Pases a buffer with Little Endian Representation
// Passes a buffer with Little Endian Representation
export const fromRprLE = (buff: Uint8Array, o: number, n8?: number): bigint => {
n8 = n8 || buff.byteLength;
o = o || 0;
Expand All @@ -223,7 +223,7 @@ export const fromRprLE = (buff: Uint8Array, o: number, n8?: number): bigint => {
return fromString(a.join(''), 16);
};

// Pases a buffer with Big Endian Representation
// Passes a buffer with Big Endian Representation
export const fromRprBE = (buff: Uint8Array, o: number, n8: number): bigint => {
n8 = n8 || buff.byteLength;
o = o || 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/sha256.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('SHA-256 Hashing', () => {

it('should hash different inputs to different values', () => {
const input1 = 'Hello, World!';
const input2 = 'Hello, Goodbay!';
const input2 = 'Hello, Good bay!';
const hash1 = sha256(encoder.encode(input1));
const hash2 = sha256(encoder.encode(input2));

Expand Down

0 comments on commit 89d8a1e

Please sign in to comment.