Documentation ¶
Overview ¶
Package hash provides helper functions for file hashing
Index ¶
- Constants
- Variables
- type HashBlock
- func (h *HashBlock) AnyFlag() HashFlags
- func (h HashBlock) Check(h2 HashBlock, ignoreempty bool) error
- func (h *HashBlock) Clear()
- func (h HashBlock) Clone(flags HashFlags) HashBlock
- func (h *HashBlock) Contains(l ...HashType) bool
- func (h *HashBlock) Etag() string
- func (h *HashBlock) EtagHeader() string
- func (h *HashBlock) Flags() HashFlags
- func (h *HashBlock) Get(key HashType) string
- func (h *HashBlock) IsZero() bool
- func (h HashBlock) JsonString() string
- func (r HashBlock) MarshalText() ([]byte, error)
- func (h *HashBlock) NewReader(r io.Reader, flags HashFlags) io.Reader
- func (h *HashBlock) NewWriter(w io.Writer, flags HashFlags) io.Writer
- func (h *HashBlock) Parse(r io.Reader) error
- func (h *HashBlock) ParseEtag(etag string)
- func (h *HashBlock) Reset()
- func (r *HashBlock) Scan(value interface{}) error
- func (h *HashBlock) Set(key HashType, val string)
- func (h HashBlock) String() string
- func (h *HashBlock) Sum()
- func (r *HashBlock) UnmarshalText(data []byte) error
- func (r HashBlock) Value() (driver.Value, error)
- type HashFlags
- type HashType
- type HashTypeList
- func (l *HashTypeList) Add(t HashType) HashTypeList
- func (l HashTypeList) Contains(t HashType) bool
- func (l HashTypeList) Flags() HashFlags
- func (r HashTypeList) MarshalText() ([]byte, error)
- func (r *HashTypeList) Scan(value interface{}) error
- func (l HashTypeList) String() string
- func (r *HashTypeList) UnmarshalText(data []byte) error
- func (r HashTypeList) Value() (driver.Value, error)
Constants ¶
View Source
const ( HASH_TYPE_INVALID = 0 HASH_TYPE_MD5 = 1 << iota HASH_TYPE_SHA1 HASH_TYPE_SHA256 HASH_TYPE_SHA512 HASH_TYPE_XXHASH HASH_TYPE_TIGER )
Variables ¶
View Source
var ( HashTypeInvalid HashType = "" HashTypeMd5 HashType = "md5" HashTypeSha1 HashType = "sha1" HashTypeSha256 HashType = "sha256" HashTypeSha512 HashType = "sha512" HashTypeXxhash HashType = "xxhash" HashTypeTiger HashType = "tiger" DefaultHash = HashTypeSha256 HashTypesAll HashTypeList = HashTypeList{ HashTypeMd5, HashTypeSha1, HashTypeSha256, HashTypeSha512, HashTypeXxhash, HashTypeTiger, } EInvalidHash = errors.New("checksums do not match") )
Functions ¶
This section is empty.
Types ¶
type HashBlock ¶
type HashBlock struct { Md5 string `json:"md5,omitempty"` // 128bit, 32 digits + 4 Sha1 string `json:"sha1,omitempty"` // 160bit, 40 digits + 5 Sha256 string `json:"sha256,omitempty"` // 256bit, 64 digits + 7 Sha512 string `json:"sha512,omitempty"` // 512bit, 128 digits + 7 XXHash string `json:"xxhash,omitempty"` // 64bit, 16 digits + 7 Tiger string `json:"tiger,omitempty"` // 192bit, 48 digits + 6 // contains filtered or unexported fields }
func (HashBlock) MarshalText ¶
Text/JSON conversion
type HashTypeList ¶
type HashTypeList []HashType
func ParseTypeList ¶
func ParseTypeList(s string) HashTypeList
func (*HashTypeList) Add ¶
func (l *HashTypeList) Add(t HashType) HashTypeList
func (HashTypeList) Contains ¶
func (l HashTypeList) Contains(t HashType) bool
func (HashTypeList) Flags ¶
func (l HashTypeList) Flags() HashFlags
func (HashTypeList) MarshalText ¶
func (r HashTypeList) MarshalText() ([]byte, error)
Text/JSON conversion
func (HashTypeList) String ¶
func (l HashTypeList) String() string
func (*HashTypeList) UnmarshalText ¶
func (r *HashTypeList) UnmarshalText(data []byte) error
func (HashTypeList) Value ¶
func (r HashTypeList) Value() (driver.Value, error)
Directories ¶
Path | Synopsis |
---|---|
Implements the Tiger/192 hash function as specified in http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger/tiger.html Tiger/160 and Tiger/128 are simply truncations of the Tiger/192 sum, so there's no specific implementation for those.
|
Implements the Tiger/192 hash function as specified in http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger/tiger.html Tiger/160 and Tiger/128 are simply truncations of the Tiger/192 sum, so there's no specific implementation for those. |
Package xxhash implements the 64-bit variant of xxHash (XXH64) as described at http://cyan4973.github.io/xxHash/.
|
Package xxhash implements the 64-bit variant of xxHash (XXH64) as described at http://cyan4973.github.io/xxHash/. |
Click to show internal directories.
Click to hide internal directories.