hashx

package
v0.0.0-...-ca8ceaf Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 9 Imported by: 0

README

hashx

Go hash functions

Installation

go get github.com/mzccddkk/gdk/hashx

Functions

hash:

func Hash(str string, h hash.Hash) string

func Md5(str string) string

func Sha1(str string) string

func Sha256(str string) string

func Sha512(str string) string

hashfile:

func HashFile(filename string, h hash.Hash) (string, error)

func Md5File(filename string) (string, error)

func Sha1File(filename string) (string, error)

func Sha256File(filename string) (string, error)

func Sha512File(filename string) (string, error)

bcrypt:

func Bcrypt(password string) string

func BcryptWithCost(password string, cost int) string

func BcryptVerify(hashedPassword string, password string) bool

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bcrypt

func Bcrypt(password string) string

Bcrypt Creates a password hash with default cost

func BcryptVerify

func BcryptVerify(hashedPassword string, password string) bool

BcryptVerify Verifies that a password matches a hashed password

func BcryptWithCost

func BcryptWithCost(password string, cost int) string

BcryptWithCost Creates a password hash with cost

The higher the cost value, the longer the time

func Hash

func Hash(str string, h hash.Hash) string

Hash Calculate the hash of a string

func HashFile

func HashFile(filename string, h hash.Hash) (string, error)

HashFile Calculate the hash of a file

func Md5

func Md5(str string) string

Md5 Calculate the md5 hash of a string

func Md5File

func Md5File(filename string) (string, error)

Md5File Calculate the md5 hash of a file

func Sha1

func Sha1(str string) string

Sha1 Calculate the sha1 hash of a string

func Sha1File

func Sha1File(filename string) (string, error)

Sha1File Calculate the sha1 hash of a file

func Sha256

func Sha256(str string) string

Sha256 Calculate the sha256 hash of a string

func Sha256File

func Sha256File(filename string) (string, error)

Sha256File Calculate the sha256 hash of a file

func Sha512

func Sha512(str string) string

Sha512 Calculate the sha512 hash of a string

func Sha512File

func Sha512File(filename string) (string, error)

Sha512File Calculate the sha512 hash of a file

Types

This section is empty.

Jump to

Keyboard shortcuts

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