qetag

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 4 Imported by: 0

README

qetag

将七牛 kodo etag 算法实现了 Golang 的 hash.Hash 接口

  • 便于上传文件到 kodo 后的完整性校验
  • 实现了 io.Reader 的数据流不用全部读取就可以计算得到七牛 etag

用法

简单用法

	qetag := New()
	_, err := qetag.Write([]byte{1, 2, 3, 4, 5, 6, 7})
    fmt.Println(qetag.Etag())

参考

  1. https://github.com/qiniu/qetag
  2. https://www.jianshu.com/p/3785fc314fc5

Documentation

Index

Constants

View Source
const (
	BLOCK_BITS = 22              // Indicate that the blocksize is 4M
	BLOCK_SIZE = 1 << BLOCK_BITS // 4Mb
)

Variables

This section is empty.

Functions

func CalSha1

func CalSha1(b []byte, r io.Reader) ([]byte, error)

CalSha1 计算 r 的 sha1,并返回 []byte{b..., sha1(r)}

func New

func New() *digest

Types

This section is empty.

Jump to

Keyboard shortcuts

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