sh256

BSD-style digest generation script
git clone git://git.ckyln.com/sh256
Log | Files | Refs | README | LICENSE

sha256 (490B)


      1 #!/bin/sh -e
      2 # Shell script to create BSD style digests using coreutils style digest
      3 # programs. Calls the digest program according to its own name.
      4 # So, sha256 -> sha256sum, md5 -> md5sum. This makes it easier to symlink and
      5 # use it multifunctionally.
      6 
      7 case "$1" in --) ;; -*|'') printf 'usage: %s [file...]\n' "${0##*/}"; exit 0; esac
      8 
      9 "${0##*/}sum" "$@" | while read -r digest file; do
     10     printf '%s (%s) = %s\n' "$(printf "${0##*/}" | tr [:lower:] [:upper:])" "$file" "$digest"
     11 done