checksum

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 7 Imported by: 28

README

checksum

GoDoc Go Report Card test coverage

Compute message digest, like MD5 and SHA256, in golang for potentially large files.

Usage

package main

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

func main() {
	file := "/home/jerry/Downloads/ubuntu-gnome-16.04-desktop-amd64.iso"
	md5, _ := checksum.MD5sum(file)
	fmt.Println(md5)
	sha256, _ := checksum.SHA256sum(file)
	fmt.Println(sha256)
}

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 MD5sum

func MD5sum(filename string) (string, error)

MD5sum returns MD5 checksum of filename

func MD5sumReader

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

MD5sumReader returns MD5 checksum of filename

func SHA256sum

func SHA256sum(filename string) (string, error)

SHA256sum returns SHA256 checksum of filename

func SHA256sumReader

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

SHA256sumReader returns SHA256 checksum of filename

func Sum

func Sum(hashAlgorithm hash.Hash, filename string) (string, error)

Sum calculates the hash based on a provided hash provider

func SumReader

func SumReader(hashAlgorithm hash.Hash, reader io.Reader) (string, error)

SumReader calculates the hash based on a provided hash provider

Types

This section is empty.

Jump to

Keyboard shortcuts

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