Skip to content

Instantly share code, notes, and snippets.

@frntn
Created September 18, 2017 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frntn/ae015b997a8255e3c99b3989d8b89af7 to your computer and use it in GitHub Desktop.
Save frntn/ae015b997a8255e3c99b3989d8b89af7 to your computer and use it in GitHub Desktop.
Gopass Binary Test
#!/bin/bash
echo -n $'\x63\x61\x74' > before.txt
echo -n $'\x63\n\x61\n\x74\n' > before_lf.txt
echo -n $'\x63\r\n\x61\r\n\x74\r\n' > before_crlf.txt
echo -n $'\x63\r\x61\r\x74\r' > before_cr.txt
echo -n $'\x01\x63\x61\x74' > before.bin
echo -n $'\x01\x63\n\x61\n\x74\n' > before_lf.bin
echo -n $'\x01\x63\r\n\x61\r\n\x74\r\n' > before_crlf.bin
echo -n $'\x01\x63\r\x61\r\x74\r' > before_cr.bin
for i in before*.txt before*.bin;
do
echo "-------------- $i"
cat "$i" | od -c
gopass insert perso/bintest/$i < "$i" >/dev/null
gopass show perso/bintest/$i > "${i/before/after}"
md5sum "$i" "${i/before/after}"
done
for i in before*.bin before*.txt
do
echo "--------------- $i"
cat $i | od -c
echo
echo "--------------- ${i/before/after}"
cat ${i/before/after} | od -c
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment