browserify / browserify/diffie-hellman
nodejs crypto module DH secret hash is not the same with diffie-hellman/browser
- Ngôn ngữ chính
- JavaScript
- Star
- 95
- Fork
- 26
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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'));
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách so sánh implementation của trình duyệt được sử dụng thông qua ./browser với module thông thường được sử dụng thông qua ./, tập trung vào getDiffieHellman, getPublicKey('hex') và computeSecret(..., 'hex'). Tái hiện ví dụ modp18 và xác minh xem cả hai phía có tạo ra các secret dạng hexadecimal giống hệt nhau hay không; issue được hoàn tất khi sự không khớp được giải thích và một regression check bao phủ các lời gọi đã minh họa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, nodejs
- Lĩnh vực
- cryptography
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100