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

discontinued

Curve25519 Diffie-Hellman (X25519).

example/curve25519.dart

import 'package:curve25519/curve25519.dart';

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

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

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

Publisher

unverified uploader

Curve25519 Diffie-Hellman (X25519).

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

cryptography

More

Packages that depend on curve25519