ed25519_edwards 0.3.1 icon indicating copy to clipboard operation
ed25519_edwards: ^0.3.1 copied to clipboard

Dart port of ed25519 from Go Cryptography ed25519

example/main.dart

import 'dart:convert';
import 'dart:typed_data';

import 'package:ed25519_edwards/ed25519_edwards.dart' as ed;

void main() {
  signAndVerify();
}

void signAndVerify() {
  var keyPair = ed.generateKey();
  var privateKey = keyPair.privateKey;
  var publicKey = keyPair.publicKey;
  var message = utf8.encode('test message');
  var sig = ed.sign(privateKey, message as Uint8List);
  var result = ed.verify(publicKey, message, sig);
  assert(result == true);

  var wrongMessage = utf8.encode('wrong message');
  var wrongResult = ed.verify(publicKey, wrongMessage as Uint8List, sig);
  assert(wrongResult == false);
}
7
likes
110
pub points
79%
popularity

Publisher

unverified uploader

Dart port of ed25519 from Go Cryptography ed25519

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

adaptive_number, collection, convert, crypto

More

Packages that depend on ed25519_edwards