Skip to content

Commit

Permalink
fix: remove debug module
Browse files Browse the repository at this point in the history
  • Loading branch information
mahnunchik committed Jun 21, 2023
1 parent 561c559 commit 5aee2ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
13 changes: 0 additions & 13 deletions lib/crypto-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
import BN from 'bn.js';
import { Buffer } from 'buffer';
import Debug from 'debug';
import keccak from 'keccak';
import randombytes from 'randombytes';
import varint from 'varint';
Expand All @@ -28,8 +27,6 @@ import {
squareRoot,
} from './helpers.js';

const debug = Debug('monerolib:crypto-util');

// TODO remove when jest.mockModule will be implemented
// https://github.com/facebook/jest/issues/10025
let randomBytes = randombytes;
Expand Down Expand Up @@ -106,7 +103,6 @@ export function checkScalar(scalar) {
decodeScalar(scalar);
return true;
} catch (err) {
debug('checkScalar error: %s', err.message);
return false;
}
}
Expand All @@ -132,7 +128,6 @@ export function checkKey(data) {
decodePoint(data);
return true;
} catch (err) {
debug('checkKey error: %s', err.message);
return false;
}
}
Expand Down Expand Up @@ -260,7 +255,6 @@ export function checkSignature(prefix, pub, sig) {
c = decodeScalar(sig.slice(0, 32));
r = decodeScalar(sig.slice(32, 64));
} catch (err) {
debug('checkSignature error: %s', err.message);
return false;
}
if (c.isZero()) {
Expand Down Expand Up @@ -356,12 +350,10 @@ export function hashToPoint(data) {
} else {
// x = x * fe_fffb1
x = x.redMul(fffb1);
debug('hashToPoint case #1');
}
} else {
// x = x * fe_fffb2
x = x.redMul(fffb2);
debug('hashToPoint case #2');
}

let odd;
Expand All @@ -385,11 +377,9 @@ export function hashToPoint(data) {
throw new TypeError('Invalid point');
} else {
x = x.redMul(fffb3);
debug('hashToPoint case #3');
}
} else {
x = x.redMul(fffb4);
debug('hashToPoint case #4');
}
}

Expand Down Expand Up @@ -493,7 +483,6 @@ export function checkRingSignature(prefix, image, pubs, sig) {
try {
P = decodePoint(image);
} catch (err) {
debug('checkRingSignature error: %s', err.message);
return false;
}
const sum = new BN(0);
Expand All @@ -505,14 +494,12 @@ export function checkRingSignature(prefix, image, pubs, sig) {
c = decodeScalar(sig.slice(0 + (i * 64), 32 + (i * 64)));
r = decodeScalar(sig.slice(32 + (i * 64), 64 + (i * 64)));
} catch (err) {
debug('checkRingSignature error: %s', err.message);
return false;
}
let P1;
try {
P1 = decodePoint(pub);
} catch (err) {
debug('checkRingSignature error: %s', err.message);
return false;
}
const P2 = P1.mul(c).add(ec.g.mul(r));
Expand Down
27 changes: 14 additions & 13 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"base58-monero": "0.0.5",
"bn.js": "^4.12.0",
"buffer": "^6.0.3",
"debug": "^4.3.1",
"elliptic": "^6.5.4",
"keccak": "^3.0.1",
"randombytes": "^2.1.0",
Expand Down

0 comments on commit 5aee2ee

Please sign in to comment.