hashing

package
v0.99.99-test-ignore Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: BSD-3-Clause Imports: 6 Imported by: 156

Documentation

Index

Constants

View Source
const AddrLen = ripemd160.Size

AddrLen ...

View Source
const HashLen = sha256.Size

HashLen ...

Variables

This section is empty.

Functions

func ByteArraysToHash256Array

func ByteArraysToHash256Array(byteArray ...[]byte) [32]byte

ByteArraysToHash256Array takes in byte arrays and outputs a fixed 32 length

byte array for the hash

func Checksum

func Checksum(bytes []byte, length int) []byte

Checksum Create checksum of [length] bytes from the 256 bit hash of the byte slice.

Returns the lower [length] bytes of the hash
Errors if length > 32.

func ComputeHash160

func ComputeHash160(buf []byte) []byte

ComputeHash160 Compute a cryptographically strong 160 bit hash of the input

byte slice.

func ComputeHash256

func ComputeHash256(buf []byte) []byte

ComputeHash256 Compute a cryptographically strong 256 bit hash of the input

byte slice.

func ComputeHash256Ranges

func ComputeHash256Ranges(buf []byte, ranges [][2]int) []byte

ComputeHash256Ranges Compute a cryptographically strong 256 bit hash of the input

byte slice in the ranges specified.

Example: ComputeHash256Ranges({1, 2, 4, 8, 16}, {{1, 2},

                                        {3, 5}})
is equivalent to ComputeHash256({2, 8, 16}).

func PubkeyBytesToAddress

func PubkeyBytesToAddress(key []byte) []byte

PubkeyBytesToAddress ...

Types

type Hash160

type Hash160 = [ripemd160.Size]byte

Hash160 A 160 bit long hash value.

func ComputeHash160Array

func ComputeHash160Array(buf []byte) Hash160

ComputeHash160Array Compute a cryptographically strong 160 bit hash of the

input byte slice.

func ToHash160

func ToHash160(bytes []byte) (Hash160, error)

ToHash160 ...

type Hash256

type Hash256 = [HashLen]byte

Hash256 A 256 bit long hash value.

func ComputeHash256Array

func ComputeHash256Array(buf []byte) Hash256

ComputeHash256Array Compute a cryptographically strong 256 bit hash of the

input byte slice.

func ToHash256

func ToHash256(bytes []byte) (Hash256, error)

ToHash256 ...

Jump to

Keyboard shortcuts

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