#!/bin/bash
# -*- Mode:Shell-script; Coding:utf-8; fill-column:132 -*-

####################################################################################################################################
# @file      mjrCSUM.sh
# @author    Mitch Richling <https://www.mitchr.me>
# @Copyright Copyright 2013 by Mitch Richling.  All rights reserved.
# @Revision  $Revision: 1.1 $ 
# @SCMdate   $Date: 2013/12/06 02:33:15 $
# @brief     Compute a file checksum.@EOL
# @Keywords  
# @Std       bash
#
#            Very inefficient way to compute the MD5, SHA1, line count, character count, and binary character count for a file.  It
#            reads the file FOUR times!!!  Still, it's easy to code up... :)
#            
#            Out is: "MD5 SHA1 LINE_COUNT CHAR_COUNT BIN_CHAR_COUNT FILE_NAME"
#            

##----------------------------------------------------------------------------------------------------------------------------------

echo `date +%s`                                         \
     `stat -c "%X %Z %Y" "$1"`                       \
     `openssl dgst -hex -md5  "$1" | sed 's/(.*)= /:/'` \
     `openssl dgst -hex -sha1 "$1" | sed 's/(.*)= /:/'` \
     `tr -d "[:print:][:space:]" < "$1" | wc -c`        \
     `wc -l -c "$1"`