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

Ed25519 #

Dart port of ed25519 from Golang ed25519

Pub package

Usage #


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

    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);
    }

APIs #

Ed25519
public
seed
newKeyFromSeed
generateKey
sign
verify
Edwards25519
FeZero
FeOne
FeAdd
FeSub
FeCopy
FeCMove
FeFromBytes
FeToBytes
FeIsNegative
FeIsNonZero
FeNeg
FeCombine
FeMul
FeSqaure
FeSquare2
FeInvert
GeDoubleScalarMultVartime
PreComputedGroupElementCMove
GeScalarMultBase
ScMulAdd
ScReduce
ScMinimal

Benchmark #

Simulate from pinenacl-dart Benchmark

MacBook Pro (16-inch, 2019), macOS Big Sur, with 2.4GHz i9 32GB

JiT (Dart VM) Benchmark

$ pub get
$ pub run benchmark/ed25519_benchmark.dart

typerateiterationstimedata throughput
Ed25519 - sign50.54 MB/s254 iterations5025 ms254.00 MB
Ed25519 - verify97.38 MB/s487 iterations5001 ms487.00 MB

AoT (native binary)

$ pub get
$ dart2native benchmark/ed25519_benchmark.dart -o ed25519_benchmark
$ ./ed25519_benchmark

typerateiterationstimedata throughput
Ed25519 - sign21.64 MB/s109 iterations5036 ms109.00 MB
Ed25519 - verify37.20 MB/s187 iterations5027 ms187.00 MB

JS (Dart2JS) benchmark

$ pub get
$ pub run benchmark/ed25519_benchmark.dart -p chrome

typerateiterationstimedata throughput
Ed25519 - sign50.17 MB/s251 iterations5002 ms251.00 MB
Ed25519 - verify95.21 MB/s477 iterations5009 ms477.00 MB
6
likes
110
pub points
69%
popularity

Publisher

unverified uploader

Dart port of ed25519 from Go Cryptography ed25519

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

adaptive_number, collection, convert, crypto

More

Packages that depend on ed25519_edwards