--------------------------------------------------------------------------------
checksum ver.1.00.00 (20240720a)

Print or check checksums

Algorithms
MD5 / SHA1 / SHA256 / SHA384/ SHA512 / cksum CRC-32 / sum (BSD) / sum (SystemV)

This is a md5sum, sha256sum, cksum and sum command like tool.

--------------------------------------------------------------------------------
 Auther
--------
ritsuka

  Web                    https://ritska.com
  X (twitter)            @ritsukaPya
  ActivityPub (misskey)  @ritsukaPya@misskey.io
  Bluesky                @ritsukapya.bsky.social

--------------------------------------------------------------------------------
 Environment
-------------
* Windows PowerShell
* PowerShell Core

--------------------------------------------------------------------------------
 Install
---------
Copy "checksum.ps1" file into any $env:Path listed directory (folder).

--------------------------------------------------------------------------------
 Usage
-------
Usage: checksum [OPTION]... [FILE]...
Print or check MD5/SHA1,256,384,512/CKSUM/SUM(BSD,SystemV) checksums.

Example:
  Display SHA256 checksums of files
    checksum *.jpg
  Display MD5 checksums of files
    checksum -a md5 *.jpg
  Display SHA256 checksums of files (recursive search in current dir)
    checksum -r *.jpg
  Display SHA256 checksums of files and save result to file (LF,UTF-8 text)
    checksum *.jpg -o CHECKSUM.txt
  Verify checksums
    checksum -c CHECKSUM.txt

With no FILE, or when FILE is -, read pipeline as text (UTF-8) or as byte[].
  Example (pipeline):
    Get-Content textfile.txt | checksum <read as UTF-8 text>
    Get-Content -AsByteStream -Raw textfile.txt | checksum <read as byte[]>
  CAUTION:
    PowerShell's pipeline receives binary data as UTF-8 string.
    And the data will be DESTROYED. It is a specification.

Create checksums:
  -a, -algorithm TYPE  select the digest type to use.  See TYPE below.
  -r, -recurse         search current dir recursive (cannot set path include dir)
  -b, -binary          read in binary mode (equal text mode, add `"*`" flag only)
  -t, -text            read in text mode (default)
  -z, -zero            end each output line with NUL, not newline
      -tag, -bsd       create a BSD-style checksum

  -o, -outfile OUTFILE output to text file (LF, UTF-8 without BOM)
  -f, -force           overwrite text file, if exist (use with -o)
      -add             add to text file, if exist    (use with -o)

Verify checksums:
  -c, -check FILE      read checksums from the FILEs and check them

Other:
      -help, -usage    display this help and exit
  -v, -version         output version information and exit
  -e, -english         print message in English regardless of user's locale

TYPE determines the digest algorithm:
  md5     : MD5 (128-bit)
  sha1    : SHA1 (160-bit)
  sha256  : SHA256 (256-bit) *DEFAULT*
  sha384  : SHA384 (384-bit)
  sha512  : SHA512 (512-bit)
  sumsysv : equivalent to UN*X "sum" command - System V algorithm
  sumbsd  : equivalent to UN*X "sum" command - BSD algorithm
  cksum   : equivalent to UN*X "cksum" command - CRC-32 algorithm

  NOTE: UN*X cksum command's algorithm is not plain CRC-32.
        Do not use this algorithm for calculating plain CRC-32 values.

--------------------------------------------------------------------------------
 Update history
----------------
2024-07-20 ver.1.00.00 (20240720a)
 * First publishing

--------------------------------------------------------------------------------
 License
---------
This software is provided under the "2-clause BSD license".

                             * * * * * * * * * * *

Copyright (C) 2024 ritsuka

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
