digest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Implementation of Bitcoin-specific hash functions, including SHA-256, RIPEMD-160 (Hash160), and TaggedHash.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoubleHash

func DoubleHash(buffer []byte) []byte

DoubleHash computes the SHA-256 hash of data twice, returning the resulting hash.

func GenerateRandom

func GenerateRandom(size int) ([]byte, error)

GenerateRandom creates a byte slice of the specified 'size' containing random data. It generates 'size' random bytes using the crypto/rand package's rand.Read function and returns the resulting byte slice. If any error occurs during the random data generation, it is returned as an error along with a nil byte slice.

The function is suitable for generating cryptographically secure random data.

func Hash160

func Hash160(buffer []byte) []byte

Hash160 computes the RIPEMD160 hash of the SHA-256 hash of data.

func HmacSHA512

func HmacSHA512(key, data []byte) []byte

HmacSHA512 computes the HMAC-SHA-512 hash of the given key and data.

func PbkdfDeriveDigest

func PbkdfDeriveDigest(mnemonic string, salt string) []byte

PbkdfDeriveDigest generates a derived key using the PBKDF2 algorithm with HMAC-SHA-512.

func SingleHash

func SingleHash(data []byte) []byte

SingleHash computes the SHA-256 hash of data.

func TaggedHash

func TaggedHash(data []byte, tag string) []byte

TaggedHash computes a tagged hash by prepending a tag byte to the input data

Types

This section is empty.

Jump to

Keyboard shortcuts

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