rclone: github.com/ncw/rclone/backend/mailru/mrhash Index | Files

package mrhash

import "github.com/ncw/rclone/backend/mailru/mrhash"

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.


Package Files



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


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

Global errors

func DecodeString Uses

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

DecodeString converts a string to the Mailru hash

func New Uses

func New() hash.Hash

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

func Sum Uses

func Sum(data []byte) []byte

Sum returns the Mailru checksum of the data.

Package mrhash imports 6 packages (graph). Updated 2019-09-12. Refresh now. Tools for package owners.