#!/bin/bash password='what a fucking strong pass phrase' Tdir=$(mktemp -d) mkdir -p $Tdir/gocrypt/{test{1..6},crypt{1..6}} cd $Tdir/gocrypt for i in {1..6};do mode='' ((i>3)) && mode=--reverse printf 'Test nro %d %s ...' $i ${mode#--} masterKey[i]=$( TERM=none script -f /dev/null -c " gocryptfs --init $mode test$i <<< '$password' " | sed -ne '/^Your master key/{N;N;N;s/^.*\r\n\r\n//; s/ *\o33[[0-9]\+m//g;s/\r\n *//;p;q};d' ) stty sane gocryptfs -q $mode test$i crypt$i <<<"$password" printf '\e[3D mounted.\n' done man -Pcat man | tee {crypt{1..3},test{4,5,6}}/file >/dev/null ls -Al test{1,2,3} crypt{4,5,6} echo "Some SHA1SUMS:" declare -iA shasums while read -r sum file;do color='' dup='' [[ -v shasums[$sum] ]] && color='\e[1m' dup=DUP${shasums[$sum]} shasums[$sum]+=1 printf '%b%-4s %s %s\e[0m\n' "$color" "$dup" "$sum" "$file" done < <(sha1sum */*.diriv */?????????????????????? */file) for dir in test{1,2,3} crypt{4,5,6}; do printf 'Master key %d: %s\n%*s' \ ${dir//[!0-9]} ${masterKey[${dir//[!0-9]}]//-} 14 '' gocryptfs-xray -dumpmasterkey $dir/gocryptfs.conf <<<"$password" done for dir in crypt*;do fusermount -u $dir done cd rm -fR $Tdir