crypto

package module
v0.0.0-...-4df494a Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0, MIT Imports: 6 Imported by: 1

README

go-crypto

Crypto utility functions used in filecoin

License

This repository is dual-licensed under Apache 2.0 and MIT terms.

Copyright 2019. Protocol Labs, Inc.

Documentation

Index

Constants

View Source
const PrivateKeyBytes = 32

PrivateKeyBytes is the size of a serialized private key.

View Source
const PublicKeyBytes = 65

PublicKeyBytes is the size of a serialized public key.

Variables

This section is empty.

Functions

func EcRecover

func EcRecover(msg, signature []byte) ([]byte, error)

EcRecover recovers the public key from a message, signature pair.

func Equals

func Equals(sk, other []byte) bool

Equals compares two private key for equality and returns true if they are the same.

func GenerateKey

func GenerateKey() ([]byte, error)

GenerateKey creates a new key using secure randomness from crypto.rand.

func GenerateKeyFromSeed

func GenerateKeyFromSeed(seed io.Reader) ([]byte, error)

GenerateKeyFromSeed generates a new key from the given reader.

func PublicKey

func PublicKey(sk []byte) []byte

PublicKey returns the public key for this private key.

func Sign

func Sign(sk, msg []byte) ([]byte, error)

Sign signs the given message, which must be 32 bytes long.

func Verify

func Verify(pk, msg, signature []byte) bool

Verify checks the given signature and returns true if it is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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