#!/bin/sh

# Create cover file
python3 -c 'import random, struct; open("cover.au", "wb").write(struct.pack(">6I", 0x2e736e64, 24, 32000, 1, 8000, 1) + random.Random().randbytes(32000))'

# Create input file
echo -n 'Lorem ipsum dolor...' > msg-in.txt

# Embed and extract
steghide embed -cf cover.au -sf out.au -ef msg-in.txt -p '' -f -q
steghide extract -sf out.au -xf msg-out.txt -p '' -f -q

# Print input and output file
echo "msg-in:  $(cat msg-in.txt)"
echo "msg-out: $(cat msg-out.txt)"
# Compare files and print result
if cmp msg-in.txt msg-out.txt; then
	echo 'match.'
	exit 0
else
	echo 'DIFFER!'
	exit 1
fi
