mrhash

package
v1.52.1-0...-9b21a15 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mrhash implements the mailru hash, which is a modified SHA1. If file size is less than or equal to the SHA1 block size (20 bytes), its hash is simply its data right-padded with zero bytes. Hash sum of a larger file is computed as a SHA1 sum of the file data bytes concatenated with a decimal representation of the data length.

Index

Constants

View Source
const (
	// BlockSize of the checksum in bytes.
	BlockSize = sha1.BlockSize
	// Size of the checksum in bytes.
	Size = sha1.Size
)

Variables

View Source
var (
	ErrorInvalidHash = errors.New("invalid hash")
)

Global errors

Functions

func DecodeString

func DecodeString(s string) ([]byte, error)

DecodeString converts a string to the Mailru hash

func New

func New() hash.Hash

New returns a new hash.Hash computing the Mailru checksum.

func Sum

func Sum(data []byte) []byte

Sum returns the Mailru checksum of the data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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