checksum

package module
Version: v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 10 Imported by: 12

README

checksum

PkgGoDev Go Report Card codecov

Compute message digest, like MD5, SHA256, SHA1, CRC or BLAKE2s-256 in Golang for potentially large files.

Usage

package main

import (
	"fmt"
	"github.com/codingsince1985/checksum"
)

func main() {
	file := "/home/jerry/Downloads/ubuntu-20.04.2.0-desktop-amd64.iso"

	md5, _ := checksum.MD5sum(file)
	fmt.Println(md5)

	sha256, _ := checksum.SHA256sum(file)
	fmt.Println(sha256)

	sha1, _ := checksum.SHA1sum(file)
	fmt.Println(sha1)

	crc32, _ := checksum.CRC32(file)
	fmt.Println(crc32)

	blake2s256, _ := checksum.Blake2s256(file)
	fmt.Println(blake2s256)
}

License

checksum is distributed under the terms of the MIT license. See LICENSE for details.

Documentation

Overview

Package checksum computes checksums, like MD5 or SHA256, for large files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blake2s256 added in v1.2.4

func Blake2s256(filename string) (string, error)

Blake2s256 returns BLAKE2s-256 checksum of filename

func Blake2s256Reader added in v1.2.4

func Blake2s256Reader(reader io.Reader) (string, error)

Blake2s256Reader returns SHA1 checksum of content in reader

func CRC32 added in v1.2.2

func CRC32(filename string) (string, error)

CRC32 returns CRC-32-IEEE checksum of filename

func CRCReader added in v1.2.2

func CRCReader(reader io.Reader) (string, error)

CRCReader returns CRC-32-IEEE checksum of content in reader

func MD5sum

func MD5sum(filename string) (string, error)

MD5sum returns MD5 checksum of filename

func MD5sumReader added in v1.1.0

func MD5sumReader(reader io.Reader) (string, error)

MD5sumReader returns MD5 checksum of content in reader

func SHA1sum added in v1.2.0

func SHA1sum(filename string) (string, error)

SHA1sum returns SHA1 checksum of filename

func SHA1sumReader added in v1.2.0

func SHA1sumReader(reader io.Reader) (string, error)

SHA1sumReader returns SHA1 checksum of content in reader

func SHA256sum

func SHA256sum(filename string) (string, error)

SHA256sum returns SHA256 checksum of filename

func SHA256sumReader added in v1.1.0

func SHA256sumReader(reader io.Reader) (string, error)

SHA256sumReader returns SHA256 checksum of content in reader

Types

This section is empty.

Jump to

Keyboard shortcuts

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