hash

package
v0.0.0-...-6e49935 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

package hash uniform the interface to create a hash objet

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t HashMethod) hash.Hash

create a hash object

func NewNoneHash

func NewNoneHash() hash.Hash

Types

type Fingerprint

type Fingerprint struct {
	// contains filtered or unexported fields
}

finger print hash algorithm, use md5+sha1+crc64

func NewFingerprint

func NewFingerprint() *Fingerprint

func (*Fingerprint) BlockSize

func (this *Fingerprint) BlockSize() int

func (*Fingerprint) Hash

func (this *Fingerprint) Hash() hash.Hash

func (*Fingerprint) Reset

func (this *Fingerprint) Reset()

func (*Fingerprint) Resetsize

func (this *Fingerprint) Resetsize(size int64)

func (*Fingerprint) Size

func (this *Fingerprint) Size() int

func (*Fingerprint) String

func (this *Fingerprint) String() string

func (*Fingerprint) Sum

func (this *Fingerprint) Sum(b []byte) []byte

func (*Fingerprint) Write

func (this *Fingerprint) Write(p []byte) (n int, err error)

type HashMethod

type HashMethod uint
const (
	NONE HashMethod = iota
	MD5
	SHA1
	SHA256
	SHA512
	CRC32
	CRC64
	FINGERPRINT //finger print, use md5+sha1+crc64
)

func (HashMethod) New

func (me HashMethod) New() (h hash.Hash)

create a hash object

func (HashMethod) StringHash

func (me HashMethod) StringHash(s string) (h string)

string hash

func (HashMethod) StringHashL

func (me HashMethod) StringHashL(s string) (h string)

string hash with length

type NoneHash

type NoneHash struct {
	// contains filtered or unexported fields
}

func (*NoneHash) BlockSize

func (this *NoneHash) BlockSize() int

func (*NoneHash) ReadFrom

func (this *NoneHash) ReadFrom(r io.Reader) (n int64, err error)

func (*NoneHash) Reset

func (this *NoneHash) Reset()

func (*NoneHash) Size

func (this *NoneHash) Size() int

func (*NoneHash) Sum

func (this *NoneHash) Sum(b []byte) []byte

func (*NoneHash) Write

func (this *NoneHash) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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