tiger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2019 License: BSD-3-Clause Imports: 7 Imported by: 3

Documentation

Overview

Package tiger implements Tiger hash function and TTH (Tiger Tree Hash) algorithm.

Index

Constants

View Source
const (
	BlockSize = 64 // 512 bits
	Size      = 24 // 192 bits
)

Variables

This section is empty.

Functions

func New

func New() hash.Hash

Returns a new hash.Hash that calculates the Tiger/192 hash digest.

func New2

func New2() hash.Hash

Returns a new hash.Hash that calculates the Tiger2/192 hash digest.

Tiger2 is exactly the same as Tiger but with a different padding scheme: while Tiger uses MD4's scheme of a 0x01 byte followed by zeros, Tiger2 uses MD5's scheme of a 0x80 byte followed by zeros.

Types

type Hash

type Hash [Size]byte

Hash is a tiger hash value.

func HashBytes

func HashBytes(b []byte) (out Hash)

HashBytes calculates the tiger hash of a byte slice.

func MustParseBase32

func MustParseBase32(s string) (out Hash)

MustParseBase32 parses the tiger hash from base32 encoding and panics on error.

func TreeHash

func TreeHash(r io.Reader) (root Hash, err error)

TreeHash calculates a Tiger Tree Hash of a reader.

func (Hash) Base32

func (h Hash) Base32() string

Base32 returns base32 representation of the hash.

func (Hash) Bytes

func (h Hash) Bytes() []byte

Bytes returns byte slice from the hash. Same as h[:].

func (*Hash) FromBase32

func (h *Hash) FromBase32(s string) error

FromBase32 parses hash from base32 encoding.

func (Hash) Hex

func (h Hash) Hex() string

Hex returns hexadecimal representation of the hash.

func (Hash) IsZero

func (h Hash) IsZero() bool

IsZero check if hash value is zero.

func (Hash) MarshalAdc

func (h Hash) MarshalAdc() ([]byte, error)

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Hash) String

func (h Hash) String() string

String returns base32 representation of the hash.

func (*Hash) UnmarshalAdc

func (h *Hash) UnmarshalAdc(s []byte) error

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

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.

Jump to

Keyboard shortcuts

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