Cryptographic tools and hashes
Encryption techniques are used to protect data from unauthorized access. Unlike the checksum algorithms we just discussed, encryption programs can reconstruct the original data with no loss. There are many algorithms available and we will discuss those most commonly used in the Linux/Unix world.
How to do it...
Let's see how to use tools such as crypt
, gpg
, and base64
:
- The
crypt
command is not commonly installed on Linux systems. It's a simple and relatively insecure cryptographic utility that accepts input fromstdin
, requests apassphrase
, and sends encrypted output tostdout
:
$ crypt <input_file >output_file Enter passphrase:
We can provide a passphrase on the command line:
$ crypt PASSPHRASE <input_file >encrypted_file
In order to decrypt the file, use this:
$ crypt PASSPHRASE -d <encrypted_file >output_file
gpg
(GNU privacy guard) is a widely used tool for protecting files to ensure that data is not read until it reaches its intended destination...