hash

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

hash

This package is used to calculate file hash.

The NewWithOs method will automatically call the os.File.Close() method by default. To prevent the call, see the following example.

package main

import (
    "fmt"
    "os"

	"github.com/3JoB/ulib/fsutil/hash"
)

func main(){
    y, err := os.Open("GMakefile.yml")
    if err != nil {
        return nil
    }
    md5, _ := hash.NewWithOs(y).DisableAutoClose().MD5()
    fmt.Println(md5)
}

Documentation

Index

Constants

View Source
const (
	MD5             = iota
	SHA1            // New()
	SHA224          // New()
	SHA256          // New()
	SHA384          // New()
	SHA512_224      // New()
	SHA512_256      // New()
	SHA512          // New()
	Fnv128          // New()
	Fnv128a         // New()
	CRC32           // New32()
	CRC32Castagnoli // New32()
	CRC32Koopman    // New32()
	Fnv32           // New32()
	Fnv32a          // New32()
	CRC64           // New64()
	CRC64ECMA       // New64()
	Fnv64           // New64()
	Fnv64a          // New64()
)

Variables

This section is empty.

Functions

func New

func New(path string, opt *HashOpt) string

func New32 added in v1.13.0

func New32(path string, opt *HashOpt) string

func New64 added in v1.13.0

func New64(path string, opt *HashOpt) string

Types

type HashOpt added in v1.12.0

type HashOpt struct {
	HMACKey string
	Crypt   int
}

Jump to

Keyboard shortcuts

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