Replace all characters in file.txt with a random four-character string generated by OpenSSL, and create a backup of the original file with the extension .bak.
sed -i.bak 's/[^ ]/\x$(openssl rand -base64 4)/g' file.txt