WavesPlatform.csharp-lib-crypto 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package WavesPlatform.csharp-lib-crypto --version 0.0.1
NuGet\Install-Package WavesPlatform.csharp-lib-crypto -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WavesPlatform.csharp-lib-crypto" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WavesPlatform.csharp-lib-crypto --version 0.0.1
#r "nuget: WavesPlatform.csharp-lib-crypto, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WavesPlatform.csharp-lib-crypto as a Cake Addin
#addin nuget:?package=WavesPlatform.csharp-lib-crypto&version=0.0.1

// Install WavesPlatform.csharp-lib-crypto as a Cake Tool
#tool nuget:?package=WavesPlatform.csharp-lib-crypto&version=0.0.1

csharp-lib-crypto

C# implementation of the unified crypto primitives for Waves Platform

Include

using csharp_lib_crypto;

Seed generation

var crypto = new WavesCrypto();
string seed = crypto.RandomSeed();

Keys and address

publicKey

var crypto = new WavesCrypto();
string seed = "uncle push human bus echo drastic garden joke sand warfare sentence fossil title color combine";
var publicKey = crypto.PublicKey(seed);
int nonce = 0;
publicKey = crypto.PublicKey(seed, nonce);

privateKey

var crypto = new WavesCrypto();
string seed = "uncle push human bus echo drastic garden joke sand warfare sentence fossil title color combine";
var privateKey = crypto.PrivateKey(seed);
int nonce = 0;
privateKey = crypto.PrivateKey(seed, nonce);

keyPair

var crypto = new WavesCrypto();
string seed = "uncle push human bus echo drastic garden joke sand warfare sentence fossil title color combine";
var keyPair = new KeyPair(seed);

address

var crypto = new WavesCrypto();
string seed = "uncle push human bus echo drastic garden joke sand warfare sentence fossil title color combine";
var address = crypto.Address(seed, WavesChainId.MAIN_NET_CHAIN_ID); //or WavesChainId.TEST_NET_CHAIN_ID

Signatures

signBytes

            var crypto = new WavesCrypto();
            var seed = "uncle push human bus echo drastic garden joke sand warfare sentence fossil title color combine";
            var bytes = new byte[] { 117, 110, 99, 108, 101};
            
            var sign = crypto.SignBytes(bytes, seed);
            
            var privateKey = "8bg5KM2n5kKQE6bVZssvwMEivc6ctyKahfGLkQfszZfY";
            var sign2 = crypto.SignBytesWithPrivateKey(bytes, privateKey);

verifySignature

var crypto = new WavesCrypto();
var seed = "uncle push human bus echo drastic garden joke sand warfare sentence fossil title color combine";
var bytes = new byte[] { 117, 110, 99, 108, 101};
var sign = crypto.SignBytes(bytes, seed);
crypto.VerifySignature(publicKeyInit, bytes, sign);

Hashing

blake2b

var crypto = new WavesCrypto();
var bytes = new byte[] { 117, 110, 99, 108, 101};
crypto.Blake2b(bytes);

keccak

var crypto = new WavesCrypto();
var bytes = new byte[] { 117, 110, 99, 108, 101};
crypto.Keccak(bytes);

sha256

var crypto = new WavesCrypto();
var bytes = new byte[] { 117, 110, 99, 108, 101};
crypto.Sha256(bytes);

Random

randomBytes

var crypto = new WavesCrypto();
var size = 5;
var bytes = crypto.RandomBytes(size);

Base encoding\decoding

var crypto = new WavesCrypto();
var bytes = crypto.RandomBytes(32);

var base16String = crypto.Base16Encode(bytes);
var bytesFromBase16 = crypto.Base16Decode(base58String);

var base58String = crypto.Base58Encode(bytes);
var bytesFromBase58 = crypto.Base58Decode(base58String);

var base64String = crypto.Base64Encode(bytes);
var bytesFromBase64 = crypto.Base64Decode(base58String);

Messaging

- sharedKey

Utils

stringToBytes

var crypto = new WavesCrypto();
var bytes = new byte[] { 6, 7, 8, 4 };
var stringFromBytes = crypto.BytesToString(bytes);

bytesToString

var crypto = new WavesCrypto();
var bytes = "WAVES";
var bytesFromString = crypto.StringToBytes(stringFromBytes);

Constants

    static class WavesCryptoConstants
    {
        public const int PUBLIC_KEY_LENGTH = 32;
        public const int PRIVATE_KEY_LENGTH = 32;
        public const int SIGNATURE_LENGTH = 64;
    }

    public enum WavesChainId
    {
        MAIN_NET_CHAIN_ID = 87,
        TEST_NET_CHAIN_ID = 84,
    }
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.3 1,024 8/22/2019
0.0.2 930 8/21/2019
0.0.1 909 8/21/2019