crypto

package
v0.0.0-...-a3f0f6a Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMAC

func CheckMAC(message, messageMAC []byte, key Hash256) bool

checks HMAC-SHA-256

func ComputeMAC

func ComputeMAC(key Hash256, message []byte) []byte

computes HMAC-SHA-256

func GenerateCipherStream

func GenerateCipherStream(key, nonce []byte, numBytes int) ([]byte, error)

generates cipher stream of size numBytes from a given PRG. TODO: generalize to other ciphers

func GetCurve

func GetCurve(priv ecdsa.PrivateKey) ec.Curve

Types

type Hash256

type Hash256 [sha256.Size]byte

func ComputeBlindingFactor

func ComputeBlindingFactor(pubKey *ecdsa.PublicKey, secret Hash256) Hash256

computes blinding factor used for blinding the cyclic group element at each hop. The blinding factor is computed by hashing the concatenation of the the hop's public key and the secret key derived between the sender and the hop blinding_factor := sha256(hopPubKey || sharedSecret)

func GenerateECDHSharedSecret

func GenerateECDHSharedSecret(pub *ecdsa.PublicKey, priv *ecdsa.PrivateKey) Hash256

generates shared secret using ECDH protocol in an arbitrary curve. The shared secret is the hash of the resulting x coordinate of point after scalar multiplication between the a ECDSA key pair.

Jump to

Keyboard shortcuts

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