browserify / browserify/diffie-hellman
nodejs crypto module DH secret hash is not the same with diffie-hellman/browser
- Lingua principale
- JavaScript
- Stelle
- 95
- Fork
- 26
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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'));
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia confrontando l'implementazione del browser utilizzata tramite ./browser con il modulo normale utilizzato tramite ./, concentrandoti su getDiffieHellman, getPublicKey('hex') e computeSecret(..., 'hex'). Riproduci l'esempio modp18 e verifica se entrambi i lati producono segreti esadecimali identici; l'issue è conclusa quando la discrepanza è spiegata e un controllo di regressione copre le chiamate mostrate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, nodejs
- Ambito
- cryptography
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100