checksum

package
v0.0.0-...-1aa968d Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const CHECKSUMLEN uint = 32

Variables

This section is empty.

Functions

func AreEqual

func AreEqual(checksum1, checksum2 CheckSum) bool

Simply compares 2 given checksums. If they are equal - returns true

func ChecksumToBytes

func ChecksumToBytes(checksum CheckSum) []byte

Converts given checksum into []byte

Types

type CheckSum

type CheckSum [CHECKSUMLEN]byte

func BytesToChecksum

func BytesToChecksum(bytes []byte) (CheckSum, error)

Tries to convert given bytes into CheckSum type

func GetPartialCheckSum

func GetPartialCheckSum(file *os.File) (CheckSum, error)

returns a checksum of given file. NOTE, that it creates checksum not of a full file (from all file bytes), but from separate byte blocks. This is done as an optimisation because the file can be very large in size. The general idea: BOF... CHUNK -> STEP -> CHUNK... EOF checksum := sha256.Sum256(ALLCHUNKS) GetPartialCheckSum is default method used to get a file checksum by sender and receiver

Jump to

Keyboard shortcuts

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