crypto

package
v0.0.0-...-61460eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

* MIT License

* MIT License

Copyright (c) 2018 WavesPlatform

Index

Constants

View Source
const (
	DigestSize     = 32
	SignatureSize  = 64
	PublicKeySize  = 32
	SecretKeySize  = 32
	PrivateKeySize = 64
)

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair(seed []byte) (SecretKey, PublicKey, error)

func GenerateWavesKey

func GenerateWavesKey(rand io.Reader) (publicKey *[PublicKeySize]byte, privateKey *[PrivateKeySize]byte, err error)

GenerateWavesKey generates a public/private key pair using randomness from rand.

func PublicKeyToCurve25519

func PublicKeyToCurve25519(curve25519Public *[32]byte, publicKey *[32]byte) bool

PublicKeyToCurve25519 converts an Ed25519 public key into the curve25519 public key that would be generated from the same private key.

func ToBase58JSON

func ToBase58JSON(b []byte) []byte

Types

type Digest

type Digest [DigestSize]byte

func FastHash

func FastHash(data []byte) (Digest, error)

func NewDigestFromBase58

func NewDigestFromBase58(s string) (Digest, error)

func NewDigestFromBytes

func NewDigestFromBytes(b []byte) (Digest, error)

func SecureHash

func SecureHash(data []byte) (Digest, error)

func (Digest) MarshalJSON

func (d Digest) MarshalJSON() ([]byte, error)

type PublicKey

type PublicKey [PublicKeySize]byte

func GeneratePublicKey

func GeneratePublicKey(sk SecretKey) PublicKey

GeneratePublicKey generates a public key from a secret key.

func NewPublicKeyFromBase58

func NewPublicKeyFromBase58(s string) (PublicKey, error)

func NewPublicKeyFromBytes

func NewPublicKeyFromBytes(b []byte) (PublicKey, error)

func (*PublicKey) Bytes

func (k *PublicKey) Bytes() []byte

func (PublicKey) MarshalJSON

func (k PublicKey) MarshalJSON() ([]byte, error)

func (PublicKey) String

func (k PublicKey) String() string

type SecretKey

type SecretKey [SecretKeySize]byte

func GenerateSecretKey

func GenerateSecretKey(seed []byte) SecretKey

func NewSecretKeyFromBase58

func NewSecretKeyFromBase58(s string) (SecretKey, error)

func (SecretKey) Bytes

func (k SecretKey) Bytes() []byte

func (SecretKey) String

func (k SecretKey) String() string

type Signature

type Signature [SignatureSize]byte

func Sign

func Sign(secretKey SecretKey, data []byte) (Signature, error)

func (Signature) MarshalJSON

func (s Signature) MarshalJSON() ([]byte, error)

func (Signature) String

func (s Signature) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL