crypto

package
v1.13.14 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const HashLength = 32

Variables

This section is empty.

Functions

func Hash

func Hash(data interface{}) string

Hash computes hash of the given data using RawHash and returns result as hex decoded string.

func RawHash

func RawHash(data interface{}) []byte

RawHash computes SHA3-256 hash depending on data type and returns the hash bytes.

RawHash panics if data type is unknown.

Known types:

- []byte

- HashBytes

- string

func ReadKeysFile

func ReadKeysFile(keysFile string) (publicKey, privateKey []byte, err error)

ReadKeysFile reads file existing in keysFile dir and parses public and private keys from file.

func Verify

func Verify(publicKey, signature, hash, scheme string) (bool, error)

Verify verifies passed signature of the passed hash with passed public key using the signature scheme.

Types

type HashBytes

type HashBytes [HashLength]byte

Jump to

Keyboard shortcuts

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