Skip to content

Commit

Permalink
Merge pull request #6 from multiparty/dependencies
Browse files Browse the repository at this point in the history
Force key to be of hex format
  • Loading branch information
frederickjansen authored Oct 22, 2019
2 parents a08c3cf + 604ee77 commit 6305e3c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,30 @@
},
"homepage": "https://github.com/multiparty/oprf#readme",
"dependencies": {
"bn.js": "^4.11.8",
"coveralls": "^3.0.2",
"elliptic": "^6.4.0"
"bn.js": "5.0.0",
"elliptic": "6.5.1"
},
"devDependencies": {
"@types/chai": "^4.1.4",
"@types/mocha": "^5.2.3",
"@types/node": "^10.3.6",
"chai": "^4.1.2",
"libsodium-wrappers-sumo": "^0.7.3",
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.7",
"@types/node": "^10.14.13",
"chai": "^4.2.0",
"coveralls": "^3.0.4",
"libsodium-wrappers-sumo": "0.7.3",
"mocha": "^5.2.0",
"nyc": "^12.0.2",
"sinon": "^6.3.5",
"nyc": "^14.1.1",
"sinon": "^7.3.2",
"source-map-support": "^0.5.6",
"ts-loader": "^4.4.2",
"ts-loader": "^4.5.0",
"ts-node": "^7.0.0",
"tslint": "^5.10.0",
"typedoc": "^0.13.0",
"tslint": "^5.18.0",
"typedoc": "^0.15.0",
"types-bn": "0.0.1",
"typescript": "^2.9.2",
"webpack": "^4.14.0",
"webpack-cli": "^3.0.8"
"webpack": "^4.40.2",
"webpack-cli": "^3.3.9"
},
"peerDependencies": {
"libsodium-wrappers-sumo": "^0.7.3"
"libsodium-wrappers-sumo": "0.7.3"
}
}
4 changes: 2 additions & 2 deletions src/oprf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class OPRF {
/**
* Salts a point using a key as a scalar
* @param point number array representation of a masked point
* @param key private key of server
* @param key private key of server in hex format
* @returns {string} salted point in hex format
*/
public scalarMult(point: number[], key: string): number[] {
Expand All @@ -107,7 +107,7 @@ export class OPRF {
throw new Error('Input is not a valid ED25519 point.');
}

const scalar: BN = new BN(key);
const scalar: BN = new BN(key, 16);
// point: elliptic point
const p = this.ed.decodePoint(point);

Expand Down
4 changes: 2 additions & 2 deletions test/oprf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('End-to-End', () => {
const hashedPoint = oprf.hashToPoint(input);
const result = oprf.scalarMult(hashedPoint, scalarKey);

const known_result = [104, 232, 164, 133, 219, 182, 80, 68, 105, 227, 199, 179, 193, 54, 190, 2, 98, 151, 102, 236, 117, 228, 252, 88, 186, 89, 224, 226, 27, 186, 238, 126];
const known_result = [67, 211, 62, 241, 3, 58, 144, 120, 39, 14, 255, 148, 90, 209, 115, 56, 238, 5, 58, 143, 33, 206, 223, 209, 240, 173, 177, 214, 71, 88, 131, 222];
expect(unmasked).to.deep.equals(result).to.deep.equals(known_result);
});

Expand Down Expand Up @@ -236,7 +236,7 @@ describe('Expected Behavior', () => {
const unmasked2 = oprf.unmaskInput(salted2, masked2.mask);
const unmasked3 = oprf.unmaskInput(salted3, masked3.mask);

const known_output = [44, 245, 118, 84, 55, 249, 213, 84, 216, 193, 217, 165, 140, 215, 79, 3, 249, 81, 22, 79, 170, 98, 92, 55, 88, 56, 55, 186, 101, 169, 232, 31];
const known_output = [221, 1, 0, 60, 186, 172, 201, 218, 147, 12, 254, 230, 80, 113, 61, 205, 21, 27, 0, 213, 57, 192, 34, 56, 82, 185, 185, 153, 8, 250, 191, 19];

expect(unmasked1).to.deep.equals(unmasked2).to.deep.equals(unmasked3).to.deep.equals(known_output);
});
Expand Down

0 comments on commit 6305e3c

Please sign in to comment.