#!/usr/bin/env bash

[ -z $1 ] && echo 'missing file' && exit 1
[ ! -f $1 ] && echo 'file not exists' && exit 1

filename=$(basename $1 '.zip')
filename="$filename-checksums.txt"
echo "$1" > "$filename"

sum=$(md5sum $1 | cut -d' ' -f1)
sum="MD5: $sum"
echo $sum >> $filename

sum=$(sha1sum $1 | cut -d' ' -f1)
sum="SHA1: $sum"
echo $sum >> $filename

sum=$(sha256sum $1 | cut -d' ' -f1)
sum="SHA256: $sum"
echo $sum >> $filename

sum=$(sha512sum $1 | cut -d' ' -f1)
sum="SHA512: $sum"
echo $sum >> $filename

cat $filename
