GitXplorerGitXplorer
T

ed25519

public
18 stars
6 forks
1 issues

Commits

List of commits on branch master.
Unverified
7353ba759ea9f4646cbf481c2ef949625c8ce4cf

Update benchmark and README

TTougee committed 3 years ago
Unverified
944daea677c4d7f3abea608f55b34aec93bb79fb

Bump version to 0.3.1

TTougee committed 3 years ago
Verified
899054209fce43795e8ac9a5fe08fdd6a72d9670

Moved Number class to dedicated library: adaptive_number (#5)

llemoony committed 3 years ago
Unverified
7c6c70329404f8cafedea3528ca60f04e4ae85a7

Bump version to 0.3.0

TTougee committed 3 years ago
Unverified
d3728bc7f783aa49271ce47634e029a21b10676d

Update benchmark results

TTougee committed 3 years ago
Unverified
715c9e6214b4fe8a4bfd8caac06e85ba37f7be68

Modify tests for adptive web platform

TTougee committed 3 years ago

README

The README file for this repository.

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

dart test test/benchmark/ed25519_benchmark.dart

type rate iterations time data throughput
Ed25519 - sign 50.54 MB/s 254 iterations 5025 ms 254.00 MB
Ed25519 - verify 97.38 MB/s 487 iterations 5001 ms 487.00 MB

AoT (native binary)

dart2native test/benchmark/ed25519_benchmark.dart -o ed25519_benchmark
./ed25519_benchmark

type rate iterations time data throughput
Ed25519 - sign 21.64 MB/s 109 iterations 5036 ms 109.00 MB
Ed25519 - verify 37.20 MB/s 187 iterations 5027 ms 187.00 MB

JS (Dart2JS) benchmark (too slow, suggest using other libs for dart2js and flutter web)

dart test test/benchmark/ed25519_benchmark.dart -p chrome

type rate iterations time data throughput
Ed25519 - sign 797.03 KB/s 4 iterations 5139 ms 4.00 MB
Ed25519 - verify 1.53 MB/s 8 iterations 5231 ms 8.00 MB