Code Monkey home page Code Monkey logo

pedersen-hash.net's Introduction

Pedersen-Hash.Net

Build status Test status codecov Nuget version Total nuget downloads

This project is a C# implementation of Pedersen Hash used in Tornado Cash encrypted notes.

Public Interface

  • PedersenHashGenerator.GetHexCommitmentFromPrivatePair(string commitmentSecret): string — Get hexed public commitment for hex commitment secret
  • PedersenHashGenerator.GetHexCommitmentFromPrivatePair(byte[] commitmentSecret): string — Get hexed public commitment for byte array commitment secret
  • PedersenHashGenerator.GetCommitmentFromPrivatePair(string commitmentSecret): byte[] — Get 32-bytes array with public commitment for hex commitment secret
  • PedersenHashGenerator.GetCommitmentFromPrivatePair(byte[] commitmentSecret): byte[] — Get 32-bytes array with public commitment for byte array commitment secret

Example

Check commitment

var commitment = PedersenHashGenerator.GetHexCommitmentFromPrivatePair("0xc0b94c09303630d49984ee319ef44beb1cd29eb6d4f1f7fb8955731d76d79a5e94e1676adba37f0c7110db02b3cdc526f960d4c2685da441597c7533aa3d");
const string expectedCommitment = "0x01cd97f5fb94b8bd45979703af68790dff36dfb13c8227d6b68349fac72ff949";

Console.WriteLine("{0}\t{1}", commitment, commitment == expectedCommitment);

Benchmark

License

Licensed under the GPL-3.0.

This software is provided "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Source code was transpiled from JavaScript code:

pedersen-hash.net's People

Contributors

nokitakaze avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

pedersen-hash.net's Issues

move to netstandard2.0

in my opinion netstandard is common version so if you wanna sharing library as nupkg you shouldn't avoid my recommendation - "move to netstandard2.0"

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.