-1

So I read this questionUrandom Alternative, but I am unable to make a comment there (without 50 rep) - therefore I open a separate question: If I use this command instead of dd and urandom, how do I set the size of the resulting randomfile.bin?

openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero > randomfile.bin

1 Answers1

3

The problem is that you are reading from /dev/zero that will generate infinity zeros, a way to limit it is using head command to control the size of the output, and pipe that instead of passing it as the input file. So a way to generate a 65535 file is the following:

head -c 65535 /dev/zero | openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt  > randomfile.bin