Git Product home page Git Product logo

dart-bip340's Introduction

bip340 Pub

Implements basic signing and verification functions for the BIP-340 Schnorr Signature Scheme.

It passes the tests attached to the BIP (dart run example/example.dart to run that), but no guarantees are made of anything and this is not safe cryptography, do not use to store Bitcoins.

Provides these functions:

  1. String sign(String privateKey, String message, String aux)

Generates a schnorr signature using the BIP-340 scheme.

  • privateKey must be 32-bytes hex-encoded, i.e., 64 characters.
  • message must also be 32-bytes hex-encoded (a hash of the actual message).
  • aux must be 32-bytes random bytes, generated at signature time.
  • Returns the signature as a string of 64 bytes hex-encoded, i.e., 128 characters.
  1. bool verify(String publicKey, String message, String signature)

Verifies a schnorr signature using the BIP-340 scheme.

  • publicKey must be 32-bytes hex-encoded, i.e., 64 characters (if you have a pubkey with 33 bytes just remove the first one).
  • message must also be 32-bytes hex-encoded (a hash of the actual message).
  • signature must be 64-bytes hex-encoded, i.e., 128 characters.
  • Returns true if the signature is valid, false otherwise.
  1. String getPublicKey(String privateKey)

Produces the public key from a private key

  • privateKey must be a 32-bytes hex-encoded string, i.e. 64 characters.
  • Returns a public key as also 32-bytes hex-encoded.

Made for integration with Nostr.

dart-bip340's People

Contributors

5antoshernandez avatar fiatjaf avatar ravipatelgit avatar vincenzopalazzo 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.