hash

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 10 Imported by: 19

Documentation

Overview

Package hash includes a general-purpose hashing algorithm, blake2b, that should be suitable for most of our needs. It also includes functions to calculate an HMAC.

Package hash includes a general-purpose hashing algorithm, blake2b, that should be suitable for most of our needs. It also includes functions to calculate an HMAC.

Index

Constants

This section is empty.

Variables

View Source
var CMixHash = crypto.BLAKE2b_256

CMixHash type is currently BLAKE2b_256

Functions

func CreateHMAC

func CreateHMAC(message, key []byte) []byte

NewHMAC creates a new Message Authentication Code from a message payload and a key. This function does not accept keys that are less than 256 bits (or 32 bytes) *Function was copied from (https://golang.org/pkg/crypto/hmac/), we need to analyze this again in the future *

func DefaultHash

func DefaultHash() hash.Hash

DefaultHash returns a CMIX hash or panics

func ExpandKey

func ExpandKey(h func() hash.Hash, g *cyclic.Group, key []byte,
	output *cyclic.Int) *cyclic.Int

ExpandKey is a function that receives a key and expands such key to the size of the prime group

func NewCMixHash

func NewCMixHash() (hash.Hash, error)

NewCMixHash returns the current cMix hash implementation which is currently the 256 bit version of blake2b

func VerifyHMAC

func VerifyHMAC(message, MAC, key []byte) bool

CheckHMAC receives a MAC value along with the respective message and key associated with the Msg Authentication Code Returns true if calculated MAC matches the received one. False if not. *Function was copied from (https://golang.org/pkg/crypto/hmac/), we need to analyze this again in the future *

Types

type NewHash

type NewHash interface {
	New() hash.Hash
}

Jump to

Keyboard shortcuts

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