Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- USAGE="$0 SOURCE_FILE MSG_SIZE MSG_COUNT
- with:
- SOURCE_FILE the file from which the random binary is read
- MSG _SIZE the size in characters of each message
- MSG _COUNT the number of messages produced in a file
- "
- SOURCE_FILE=$1
- MSG_SIZE=$2
- MSG_COUNT=$3
- if [ -z $SOURCE_FILE ] || [ -z $MSG_SIZE ] || [ -z $MSG_COUNT ]
- then
- echo 'ERROR: Missing argument'
- echo $USAGE
- exit 1
- fi
- base64 -w $MSG_SIZE $SOURCE_FILE | head -n $MSG_COUNT | {
- i=1
- while read line
- do
- sha=$(echo $line | sha512sum | cut -d ' ' -f 1)
- echo "$i|$sha|$line"
- i=$(($i + 1))
- done
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement