k-s-t-i / curve25519-dart Goto Github PK
View Code? Open in Web Editor NEWCurve25519 Library for cryptographic signing and verifying. Supports VRF signatures and agreements.
License: BSD 2-Clause "Simplified" License
Curve25519 Library for cryptographic signing and verifying. Supports VRF signatures and agreements.
License: BSD 2-Clause "Simplified" License
Thanks for this implementations, a good choice for Signal XVEdDSA.
core benchmark code
import 'dart:typed_data';
import 'package:curve25519_vrf/curve25519_vrf.dart';
import 'rate_benchmark.dart';
class CurveBenchmark extends RateBenchmark {
CurveBenchmark(Type type, [int dataLength = 1024 * 1024])
: _type = type,
_data = Uint8List(dataLength),
_curve25519 = Curve25519(),
super('${type.name}');
final Curve25519 _curve25519;
final Uint8List _data;
final Type _type;
late final KeyPair _keyPair;
late Signature _signatureStandard;
late Signature _signatureVrf;
@override
void setup() {
_keyPair = _curve25519.newKeyPair();
_signatureStandard = _curve25519.sign(_keyPair, _data, SignatureType.STANDARD);
_signatureVrf = _curve25519.sign(_keyPair, _data, SignatureType.VRF);
}
@override
void run() {
if (_type == Type.signStandard) {
_curve25519.sign(_keyPair, _data, SignatureType.STANDARD);
} else if (_type == Type.verifyStandard) {
_curve25519.verify(_data, _signatureStandard);
} else if (_type == Type.signVrf) {
_curve25519.sign(_keyPair, _data, SignatureType.VRF);
} else {
_curve25519.verify(_data, _signatureVrf);
}
addSample(_data.length);
}
}
enum Type {
signStandard, verifyStandard, signVrf, verifyVrf
}
void main() {
CurveBenchmark(Type.signStandard).report();
CurveBenchmark(Type.verifyStandard).report();
CurveBenchmark(Type.signVrf).report();
CurveBenchmark(Type.verifyVrf).report();
}
results on MacBook Pro (16-inch, 2019), macOS Big Sur, with 2.4GHz i9 32GB
type | rate | iterations | time | data throughput |
---|---|---|---|---|
signStandard | 1.75 MB/s | 9 iterations | 5131 ms | 9.00 MB |
verifyStandard | 3.65 MB/s | 19 iterations | 5212 ms | 19.00 MB |
signVrf | 1.33 MB/s | 7 iterations | 5259 ms | 7.00 MB |
verifyVrf | 1.74 MB/s | 9 iterations | 5177 ms | 9.00 MB |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.