verifysfv

package
v0.0.0-...-6b8a213 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sfv provides a simple way of reading and verifying SFV (Simple File Verification) files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBufSize

func GetBufSize() uint64

func SetBufSize

func SetBufSize(bs int)

Types

type Checksum

type Checksum struct {
	Filename string
	Path     string
	CRC32    uint32
}

Checksum represents a line in a SFV file, containing the filename, full path to the file and the CRC32 checksum

func (*Checksum) IsExist

func (c *Checksum) IsExist() bool

IsExist returns a boolean indicating if the file associated with the checksum exists

func (*Checksum) Verify

func (c *Checksum) Verify(polynomial uint32) (bool, uint32, error)

Verify calculates the CRC32 of the associated file and returns true if the checksum is correct along with the calculated checksum

type SFV

type SFV struct {
	Checksums []Checksum
	Path      string
}

SFV contains all the checksums read from a SFV file.

func Find

func Find(path string) (*SFV, error)

Find tries to find a SFV file in the given path. If multiple SFV files exist in path, the first one will be returned.

func Read

func Read(filepath string) (*SFV, error)

Read reads a SFV file from filepath and creates a new SFV containing checksums parsed from the SFV file.

func (*SFV) IsExist

func (s *SFV) IsExist() bool

IsExist returns a boolean if all the files in SFV exists

func (*SFV) Verify

func (s *SFV) Verify(polynomial uint32) (bool, error)

Verify verifies all checksums contained in SFV and returns true if all checksums are correct.

Jump to

Keyboard shortcuts

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