Coder Social home page Coder Social logo

dart-schnorr's Introduction

dart-schnorr

Package schnorr implements the Schnorr signature, which is a digital signature produced by the Schnorr signature algorithm that was described by Claus Schnorr

The code is based upon the initial proposal of Pieter Wuille when it didn't have a BIP number assigned yet.

The current version passes all test vectors provided here. But the author does not give any guarantees that the algorithm is implemented correctly for every edge case!

Support all curves in elliptic package

Usage

A simple usage example:

import 'package:elliptic/elliptic.dart';
import 'package:schnorr/schnorr.dart';

void main() {
  var ec = getS256();
  var priv = ec.generatePrivateKey();
  var pub = priv.publicKey;
  print(priv);
  print(pub);
  var hashHex =
      'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9';
  var hash = List<int>.generate(hashHex.length ~/ 2,
      (i) => int.parse(hashHex.substring(i * 2, i * 2 + 2), radix: 16));

  var sig = deterministicSign(priv, hash);
  var result = verify(pub, hash, sig);

  assert(result);

  var priv2 = ec.generatePrivateKey();
  var pub2 = priv.publicKey;

  var sig2 = aggregateSign([priv, priv2], hash);
  var result2 = verify(combinePublicKeys([pub, pub2]), hash, sig2);

  assert(result2);
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

dart-schnorr's People

Contributors

c0mm4nd avatar sathish76 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.