x25519 0.1.1 copy "x25519: ^0.1.1" to clipboard
x25519: ^0.1.1 copied to clipboard

Dart port of x25519 from Go Cryptography curve25519.

Dart port of Curve25519

Pub package

Usage


import 'package:x25519/x25519.dart';

void genKeyAndX25519() {
  var aliceKeyPair = generateKeyPair();
  var bobKeyPair = generateKeyPair();

  var aliceSharedKey = X25519(aliceKeyPair.privateKey, bobKeyPair.publicKey);
  var bobSharedKey = X25519(bobKeyPair.privateKey, aliceKeyPair.publicKey);

  assert(ListEquality().equals(aliceSharedKey, bobSharedKey));
}

void useX25519() {
  const expectedHex =
      '89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a';
  var x = List<int>.filled(32, 0);
  x[0] = 1;

  for (var i = 0; i < 200; i++) {
    x = X25519(x, basePoint);
  }
  assert(HEX.encode(x) == expectedHex);
}
2
likes
140
points
6.53k
downloads

Publisher

unverified uploader

Weekly Downloads

Dart port of x25519 from Go Cryptography curve25519.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

adaptive_number, collection

More

Packages that depend on x25519