Cryptography Flashcards
What is a hash? What is the goal of hashing?
A number derived from performing a calculation on data (i.e. file). Creates a fixed-size string of bits/hexadecimal characters that cannot be reversed.
Hashing verifies data integrity.
What is encryption? What are the 2 different types of encryption?
Scrambling/ciphering data to make it unreadable if an attacker intercepts it. Will typically include an algorithm and a key.
Symmetric: same key encrypts+decrypts data.
Asymmetric: Uses a public+private key pair. What one key encrypts, the matching key decrypts.
Message Digest 5 (MD5)
Produces a 128-bit hash of data (32 hex characters). Been in use since 1992, no longer considered secure today.
Secure Hash Algorithm (SHA)
A hashing algorithm that is grouped into 4 families:
SHA-0: not used
SHA-1: creates a 160-bit hash
SHA-2: includes 4 versions: SHA-256, SHA-512, SHA-224, and SHA-512
SHA-3: alternative to SHA-2
Hash-Based Message Authentication Code (HMAC)
Combines a hashing algorithm with a shared secret (i.e. HMAC-MD5). Provides both integrity and authenticity
RACE Integrity Primitives Evaluation Message Digest (RIPEMD)
Another hashing algorithm used for integrity, but not as common as others.
Bcrypt
A key-stretching technique used mainly in Linux and UNIX distributions, protects passwords stored in the shadow password file. Salts the password (adding extra bits) before encrypting with Blowfish.
Password Based Key Derivation Function 2 (PBKDF2)
A key stretching technique that uses 64-bit salts and a pseudo-random function (i.e. HMAC) for password protection. Used by algorithms such as WPA2, Cisco OS, etc.
Initialization Vector (IV)
Provides a starting value for a cryptographic algorithm, either a fixed-sized random or pseudo-random number
XOR
A logical operation that compares 2 inputs. If the inputs are the same, it outputs a 1 (true). If not, it outputs a 0 (false).
What is the difference between a block cipher and a stream cipher?
Block Cipher encrypts data into specific-sized blocks, while a stream cipher encrypts as a stream of bits/bytes rather than fixed-size blocks.
Cipher Block Chaining (CBC)
Cipher mode that uses an IV for randomization when encrypting the 1st block, then combines each subsequent block with the previous one via XOR operation. Can sometimes suffer from pipeline delays.
Counter (CTM) Mode
Cipher mode that converts a block cipher into a stream cipher. Combines an IV with a counter and uses the result to encrypt each plaintext block. IV remains the same, but CTM combines it with the counter value, resulting in a different encryption key each time.
Galois Counter Mode (GCM)
Cipher mode that combines the counter mode of operation with Galois mode of authentication. Provides data authenticity (integrity) and confidentiality.
Substitution Cipher
Replaces plaintext with ciphertext using a fixed system (example: ROT13)