sffhmac

sffhmac

Generate an MD5, SHA1, SHA224, SHA256, SHA384 or SHA512 signature from input
file or string.

If no file is specified, any string following all the parameters is used

    sffhmac -Z sha256 -I 'appid=fip123' -K '7d11beed7346bf00a8c6063dc4003c47' -H
-D

++ For Google Authentication, put the shared secret in a FipHdr field
(Note the shared secret should NOT contain an embedded NUL/zero chr as this
will terminated the string

sffhmac -Z sha1 -K '\K1' -n 6 -N 8 -z google_otp -I '\A3'
sffhmac -Z sha1 -K '\K1' -n 6 -N 8 -z google_otp -I '\M3'
sffhmac -Z sha1 -K '\K1' -n 6 -N 8 -z google_otp -I '\P3'

+ Paramter file setup/GOOGLE_OTP will have :

; 30 secs
sum:A3:0    (\$p / 30)
sum:M3:0    (\$p / 30) - 1
sum:P3:0    (\$p / 30) + 1

To give an SHA256 hex signature to an empty string, in *nix, use /dev/null (in
Windows create and empty file and use that)

with internal display of workings
    sffhmac -Z sha256 -i /dev/null -H -D -S
or a string of ""
    sffhmac -Z sha256 -I "" -H -D -S
without internal stuff
    sffhmac -Z sha256 -i /dev/null -H -d -S

Input Variables :
    -i : file containing input (binary) no default
        a specialcase is -i stdin meaning 'read data from stdin' - usually a piped
stream
    -I : input as a FipSeq string       no default
        make sure any metachrs are escaped or are in FipSeq as it is parsed
        or use -p if input string is binary
    -k : file containing a key (binary) no default
    -K : key as a FipSeq string     no default
        make sure any metachrs are escaped or are in FipSeq as it is parsed
        or use -P if key is binary
optionals
    -a : FipSeq to add BEFORE digest is output  default: none
    -A : FipSeq to add AFTER  digest is output  default: none
    -B : no conversion of output        default: base64
    -b 32 or -b 64 output as base 32 or base64  def: base64
    -H : convert output to HEX      default: base64
    -U : if output is Hex, force Upper  default: lower case
    -d : DO NOT display internal workings   default: display just the digest
    -D : display internal workings      default: display just the digest
    -e : extraFipHdr info to add        default: none
    -F : 2 letter FipHdr field to add digest to default: none- FipHdr not changed
    -h : strip FipHdr from input file   default: fh is also data
    -n : nibble size            default: no nibble
    -l : force length of DATA       default: size varies according to string or file
    -L : force length of KEY        default: size varies according to string or file
    -o : output digest to this file     default: display just the digest
    -O : output data too            default: display just the digest
    -p : do NOT parse DATA          default: DATA is in FipSeq and needs to be parsed
    -P : do NOT parse KEY           default: KEY is in FipSeq and needs to be parsed
    -s : allow spaces in the input data default: all spaces and controls are
zapped (except for NL)
    -S : output SHA digest          default: HMAC digest
        (key is ignored for SHA)
    -x : mangle the data (lcase for allow/ ucase for zap)   default: sTCw
        s/S allow/zap spaces/tabs; n/N newlines; t/T trim leading+trailing white
space; c/C controls; w/W all whitespace
    -z : optional parameter file in tables/setup containing fipseq  default: none
    -Z : type               default: sha1
        md5 sha1 sha224 sha256 sha384 sha512
    -v : display version and exit

Currently this is ONLY on Linux and Unix and not on WINNT.
Version Control
;01i-k  5sep18 ;ij added -S and swopped -K and -k -F -O -p -P -s ; k added -x
cst
;01a-h  30dec16 chris original ;c redid doc ;e -I is now parsed ;f b32 ;g
nibbles and -z

(copyright) 2018 and previous years FingerPost Ltd.