User:Tene/Checksums

MuseWiki, wiki for the band Muse
Jump to navigation Jump to search

A little script I put together just now to check the demo's integrity.

for i in `seq 1 11`; do
flac -d "$i".flac -o 2.wav;
sox "$i".AIF a/1.raw;
sox 2.wav f/1.raw;
C1=`sha512sum a/1.raw`;
C2=`sha512sum f/1.raw`;
C3=`md5sum a/1.raw`;
C4=`md5sum f/1.raw`;
echo $C1;
echo $C2;
echo $C3;
echo $C4;
if [ "$C1"="$C2" ]; then
	echo "SHA-512 hashes equal"
else
	echo "WARNING: SHA-512 hashes NOT equal"
fi
if [ "$C3"="$C4" ]; then
	echo "MD5 hashes equal";
else
	echo "WARNING: MD5 hashes NOT equal";
fi
if [ "$C1"="$C2" ] && [ "$C3"="$C4" ]; then
	echo "Everything's good";
	echo 0"$i" - "$C1" >> sha512.txt;
	echo 0"$i" - "$C3" >> md5.txt;
else
	echo "WARNING: Corrupt file";
	exit;
fi
mv "$i".flac "$i".AIF Done;
rm *wav a/*raw f/*raw;
done;