A Golang Utility for calculating File Verification Codes which makes use of the 'FVC' and the 'extract' libraries. It processes command line arguments from the cli. The extract library is used to extract the input archive or any archives present in the input directory/archive. The FVC library is used to read each file inside the given package and to calculate the SHA256 of each file. Next, it makes use of the FVC library to sort the list of files and to calculate the verification code in Hex string or byte form. Finally, it removes any packages that were extracted during execution and prints the file count and verification code of the given package.
- main.go - contains the source code for the FVC Utility
- main() - handles the cli and calls all functions
- PrintExamples() - prints a standard set of examples
- CheckIfPkg() - checks if initial path is an archive and extracts it
- CalculateFvc() - handles the process of extraction, reading files and calculating FVC
- ExtractSubPkg() - checks for sub packages/archives and extracts it
- ReadDirectory() - read all the files inside the directory
- ExtractPkg() - extracts the given archive at the given destination
- RemovePkg() - removes all the packages extracted during execution
- main_test.go - contains the tests for everything in main.go
- testdir - contains various packages for testing
go build -mod=vendor
$ go run main.go [OPTION] <path>
or
$ fvc_utility [OPTION] <path>
$ go run main.go -b <path>
$ go run main.go -v <path>
$ go run main.go -e
Note: 'path' can be of a directory or an archive. In case of bad archives, the archives are treated as files instead.
Use
GOOS="windows" GOARCH="amd64" CC=x86_64-w64-mingw32-gcc
before any go command such as:
GOOS="windows" GOARCH="amd64" CC=x86_64-w64-mingw32-gcc go build main.go
$ go test
$ go test -v
The total number of files present in the given archive/directory.
The Verification code for the given archive/directory in bytes or Hex string depending upon choosen flags.