SutuLabs / Cryptography.EcDsa.Secp256k1

Cryptography.EcDsa.Secp256k1 library for blockchain transaction signing and verifying

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChainEngine.Cryptography.EcDsa.Secp256k1

This library compiles transaction signing and verifying algorithm secp256k1 and SHA256 which is used in several blockchains like Bitcoin, EOS and Graphene-based Steem, Golos, BitShares and of course in blockchain database UChainDb.

Usage

using UChainDB.BingChain.Engine.Cryptography;

var signAlgo = new Secp256k1();
var pubKey = signAlgo.GetPublicKey(privKey);
var data = Encoding.UTF8.GetBytes(message);

// signing
var sig = signAlgo.Sign(privKey, data);

// verifying
var result = signAlgo.Verify(pubKey, sig, data);

Installation

Install-Package UChainDB.ChainEngine.Cryptography.EcDsa.Secp256k1

API

public byte[] GetPublicKey(byte[] privateKey)
public byte[] Sign(byte[] privateKey, byte[] data)
public byte[] Sign(byte[] privateKey, IEnumerable<byte[]> data)
public bool Verify(byte[] publicKey, byte[] sig, byte[] data)
public bool Verify(byte[] publicKey, byte[] sig, IEnumerable<byte[]> data)
public byte[] GetSharedKey(byte[] privKey, byte[] pubKeyFromOther)

License

MIT

About

Cryptography.EcDsa.Secp256k1 library for blockchain transaction signing and verifying

License:MIT License


Languages

Language:C# 100.0%