Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kseo/dh
Diffie-Hellman Key-exchange algorithm in Dart
https://github.com/kseo/dh
Last synced: 27 days ago
JSON representation
Diffie-Hellman Key-exchange algorithm in Dart
- Host: GitHub
- URL: https://github.com/kseo/dh
- Owner: kseo
- License: bsd-3-clause
- Created: 2016-10-18T08:51:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-18T17:13:24.000Z (about 8 years ago)
- Last Synced: 2023-08-20T21:44:59.095Z (about 1 year ago)
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/dh
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
dh
==
[![Pub Package](https://img.shields.io/pub/v/dh.svg)](https://pub.dartlang.org/packages/dh)
[![Build Status](https://travis-ci.org/kseo/dh.svg?branch=master)](https://travis-ci.org/kseo/dh)
[![GitHub License](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/kseo/dh/master/LICENSE)Diffie-Hellman Key-exchange algorithm in Dart
## Example
```dart
import 'package:dh/dh.dart';main() {
// Generate Alice's keys...
DhGroup alice = new DhGroup.byGroupId(14);
DhKey aliceKey = alice.generateKey();
String alicePubKey = aliceKey.publicKey;// Generate Bob's keys...
DhGroup bob = new DhGroup(alice.prime, alice.generator);
DhKey bobKey = bob.generateKey();
String bobPubKey = bobKey.publicKey;// Exchange and generate the secret...
int secretKey1 = aliceKey.computeKey(new DhKey.fromPublicKey(bobPubKey));
int secretKey2 = bobKey.computeKey(new DhKey.fromPublicKey(alicePubKey));// OK
print(secretKey1);
print(secretKey1 == secretKey2);
}```