curve25519 0.1.0 copy "curve25519: ^0.1.0" to clipboard
curve25519: ^0.1.0 copied to clipboard

discontinued
outdated

Implements X25519 key exchange (elliptic curve Diffie-Hellman over Curve25519).

example/curve25519.dart

import 'package:curve25519/curve25519.dart';

void main() async {
  // Let's generate two asymmetric keypair.
  final keypair1 = await X25519().generateKeyPair();
  final keypair2 = await X25519().generateKeyPair();

  // We can now calculate a shared secret using the (sender's) private key and
  // the (recipient's) public key.
  var sharedSecret = await X25519().calculateSharedSecret(
    keypair1.secretKey,
    keypair2.publicKey,
  );
  print("#1 -> #2: ${sharedSecret.toHex()}");

  sharedSecret = await X25519().calculateSharedSecret(
    keypair2.secretKey,
    keypair1.publicKey,
  );
  print("#2 -> #1: ${sharedSecret.toHex()}"); // Same as #1 --> #2
}
0
likes
25
pub points
0%
popularity

Publisher

unverified uploader

Implements X25519 key exchange (elliptic curve Diffie-Hellman over Curve25519).

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

More

Packages that depend on curve25519