I am trying to make a folder encryption with maximum automation (except password input). Inside a bash script I do the following:
echo $RANDOM | md5sum | cut -d' ' -f1 > iv
and then using it:
openssl aes-128-cbc -md sha256 -iv $(cat iv) -in folder.7z -out folder.7z.enc
Assuming that echo $RANDOM
returns good random value, then I use md5sum
on that value, and md5sum
has collision weaknesses, so I assume that there is some security problem with that, but this is the way I found of how to produce a correct iv string for openssl
. Can someone point what exactly can be a problem with this approach, and may be give an advice how to produce a pseudo-random iv in a better way?