nodejs crypto module DH secret hash is not the same with diffie-hellman/browser
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, nodejs
- Domain
- cryptography
Research direction
Start by comparing the browser implementation used through ./browser with the regular module used through ./, focusing on getDiffieHellman, getPublicKey('hex'), and computeSecret(..., 'hex'). Reproduce the modp18 example and verify whether both sides produce identical hexadecimal secrets; the issue is done when the mismatch is explained and a regression check covers the demonstrated calls.
Written by the indexing model from the issue text.
Description
I do a test about crypto module with diffie-hellman/browser
- When I use the followed , DH secret hex is not the same,
var dh1_secret = dh1.computeSecret(dh2.getPublicKey('hex'), 'hex');
var dh2_secret = dh2.computeSecret(dh1.getPublicKey('hex'), 'hex');
console.log(dh1_secret.toString('hex') === dh2_secret.toString('hex')); // false
- when I use the followed, DH secret is the same,
var dh1_secret = dh1.computeSecret(dh2.getPublicKey());
var dh2_secret = dh2.computeSecret(dh1.getPublicKey()); // true
The followed is the completed code.
var myCrypto = require('./browser');
var crypto = require('./');
p1 = "modp18"
var dh1 = myCrypto.getDiffieHellman(p1);
let dh1_secret_key = dh1.generateKeys();
let dh1_pk = dh1.getPublicKey('hex');
let dh2 = myCrypto.getDiffieHellman(p1);
let dh2_secret_key = dh2.generateKeys();
var dh1_secret = dh1.computeSecret(dh2.getPublicKey('hex'), 'hex');
var dh2_secret = dh2.computeSecret(dh1.getPublicKey('hex'), 'hex');
console.log(dh1_secret.toString('hex') === dh2_secret.toString('hex'));
- Dominant language
- JavaScript
- Stars
- 95
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from browserify/diffie-hellman
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
browserify/diffie-hellman#33 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
browserify/diffie-hellman#28 ·
-
standalone js file? Open
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
browserify/diffie-hellman#25 · 5 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
browserify/diffie-hellman#24 ·
-
question
browserify/diffie-hellman#22 · 13 comments · 1 assignee ·
All issues in browserify/diffie-hellman
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
neondatabase/website#5944 ·
-
module: core
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·