crypto

package
v0.2.12-beta-0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomBytes

func GetRandomBytes(n int) ([]byte, error)

GetRandomBytes returns n random bytes. It returns an error if the system's pgn fails.

func GetRandomBytesToBuffer

func GetRandomBytesToBuffer(n int, buff []byte) error

GetRandomBytesToBuffer puts n random bytes using go crypto.rand into provided buff slice. buff: a slice allocated by called to hold n bytes.

func GetRandomUInt32

func GetRandomUInt32(max uint32) uint32

GetRandomUInt32 returns a uint32 in the range [0 - max).

func Keccak256

func Keccak256(data ...[]byte) []byte

Keccak256 calculates and returns the Keccak256 hash of the input data.

func Keccak256Hash

func Keccak256Hash(data ...[]byte) (h types.Hash32)

Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.

func NewUUID

func NewUUID() [16]byte

NewUUID returns a new random type-4 UUID raw bytes.

func Sha256

func Sha256(data ...[]byte) []byte

Sha256 is a SHA-3-256 (not sha-256) hasher. It returns a 32 bytes (256 bits) hash of data. data: arbitrary length bytes slice

func UUIDString

func UUIDString() string

UUIDString returns a new random type-4 UUID string.

Types

type UUID

type UUID [16]byte

UUID is a 16-len byte array represnting a UUID.

Jump to

Keyboard shortcuts

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