License: GNU Affero GPL 3.0
Original version completed and released July 25, 2016.
Last modified: Feb. 9, 2018. No changes to the code - I just renamed this repo from "flexishacheck" to "Flexishacheck".
Makes it possible to check SHA checksums more flexibly, without having to be
concerned at all about differences between the path of the file whose
checksum you want to check, and the path specified inside a checksum record
(However, this script only works with the first checksum in a checksum record
Definitely works in Lucid Puppy Linux 5.2.8 version 004 -
and Lighthouse 64 Puppy Linux 6.02 Beta 2.
Might have to be modified for other platforms.
Requires the command "shasum".
This software is free (as in freedom and as in price), libre, and open source!
-a, --algorithm [NUMBER]
<br>The checksum algorithm which the "shasum" command will be told to use.
Valid values for NUMBER are:
1, 224, 256, 384, or 512 (which is the default)
<br>Some help text.
-f, --file [PATH]
<br>A path (full/absolute, relative, or simply a filename) of a file whose
checksum you want to check.
-r, --record [PATH]
<br>A path (full/absolute, relative, or simply a filename) of a checksum
record file containing a single checksum.
The only required arguments are --file and --record, but you can use
positional arguments instead of switches.
Argument 1 is equivalent to --file.
Argument 2 is equivalent to --record.
Argument 3 is equivalent to --algorithm.
The Problems That Necessitated Flexishacheck
Traditionally (I guess), checksum record files (text files which serve as a
record of a file's checksum) contain the checksum, then 2 spaces, then the
filename - or worse yet, a longer path - of the file the checksum belongs to.
The filename/filepath part can result in various annoying problems. If you
rename the checksummed file, the "shasum" command becomes incapable of using
checksum record files containing the old filename.
And if the checksum record file contains a longer path to a file instead of
just a filename - then, even just moving the checksummed file to another
folder without renaming the checksummed file makes the checksum record file
unuseable by "shasum".
And if you relocate a checksummed file, but the checksum record file only
contains a filename rather than a path, then, "shasum" can only be made to
work by jumping through some annoying hoops. You have to change your
working directory to the new parent directory of the checksummed file before
you do this:
shasum --check "/annoyingly/long/full filepath to/ChecksumRecord.sha512"
What Flexishacheck Does
With Flexishacheck, the filename or path stored inside the checksum record
file is totally irrelevant and ignored.
Consequently, Flexishacheck can compare any file's checksum to any checksum
stored in any checksum record file - as long as that record only contains
When run, Flexishacheck creates a temporary checksum record file containing:
* The checksum contained in the first line of the checksum record file
you specified in Argument 2.
* The filepath you specified in Argument 1, which belongs to a file
whose checksum you wish to compare to the record's checksum.
Then, Flexishacheck tells shasum to do a check using the temporary checksum
record file, and the checksum algorithm you optionally specified in
Argument 3. (Or 512 by default.)
Under the GNU Affero General Public License v3.0.
Copyright (C) 2016 Apollia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact info: http://astroblahhh.com/contact-apollia.shtml