Documentation
¶
Overview ¶
Package tiger provides the Tiger hash.
Index ¶
- func MagnetLink(name string, size uint64, tth Hash) string
- func NewHash() hash.Hash
- type Hash
- type Leaves
- func LeavesFromBytes(in []byte) (Leaves, error)
- func LeavesFromFile(fpath string) (Leaves, error)
- func LeavesFromReader(in io.Reader) (Leaves, error)
- func LeavesLoadFromBytes(in []byte) (Leaves, error)
- func LeavesLoadFromFile(fpath string) (Leaves, error)
- func LeavesLoadFromReader(r io.Reader) (Leaves, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MagnetLink ¶
MagnetLink generates a link to a shared file. The link can be shared anywhere and can be opened by most of the available DC clients, starting the download.
Types ¶
type Hash ¶
Hash is the result of the hash cryptographic function. In particular, it is used to save a Tiger Tree Hash (TTH), the univoque identifier associated to a specific file content.
func HashFromBase32 ¶
HashFromBase32 imports a Hash in base32 encoding.
func HashFromBytes ¶
HashFromBytes computes the Tiger Tree Hash (TTH) of a byte slice.
func HashFromFile ¶
HashFromFile computes the Tiger Tree Hash (TTH) of a file.
func (Hash) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Hash) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Leaves ¶
type Leaves []Hash
Leaves is a sequence of hashes that can be used to validate the single parts of a file, and ultimately to compute the file TTH.
func LeavesFromBytes ¶
LeavesFromBytes computes the TTH leaves of a byte slice.
func LeavesFromFile ¶
LeavesFromFile computes the TTH leaves of a file.
func LeavesFromReader ¶
LeavesFromReader computes the TTH leaves of data provided by a Reader.
func LeavesLoadFromBytes ¶
LeavesLoadFromBytes loads TTH leaves from a byte slice. please note that this function does NOT compute TTH leaves of the input data, it just reads the data and use it as TTH leaves.
func LeavesLoadFromFile ¶
LeavesLoadFromFile loads TTH leaves from a file. please note that this function does NOT compute TTH leaves of the input data, it just reads the data and use it as TTH leaves.
func LeavesLoadFromReader ¶
LeavesLoadFromReader loads TTH leaves from data provided by a Reader. please note that this function does NOT compute TTH leaves of the input data, it just reads the data and use it as TTH leaves.
func (Leaves) SaveToBytes ¶
SaveToBytes saves the TTH leaves into a byte slice.
func (Leaves) SaveToFile ¶
SaveToFile saves the TTH leaves into a file.
func (Leaves) SaveToWriter ¶
SaveToWriter saves the TTH leaves into a Writer.