Cryptography · Topic 1 of 3

Cryptography Concepts and Encryption Algorithms

Learn symmetric and asymmetric encryption, hashing and digital signatures, with key sizes for DES, 3DES, AES, RSA, ECC, MD5 and SHA, for CEH v13.

  • 5 min
In a nutshell
  • Symmetric: one shared key, fast. Asymmetric: key pair, slower.
  • AES uses 128, 192 or 256 bit keys in 128 bit blocks.
  • RSA, DSA, ECC and Diffie-Hellman are asymmetric. Diffie-Hellman is for key exchange.

What it is

Cryptography is the practice of protecting information so that only the intended parties can read or change it. It provides confidentiality, integrity, authentication and non-repudiation.

This page covers the core concepts and the main algorithms: symmetric ciphers, asymmetric ciphers, hash functions and digital signatures. The exam asks you to match an algorithm to its type, key size or purpose.

PlaintextEncryptalgorithm and keyCiphertextDecryptalgorithm and keyPlaintext

How it works

Core concepts

TermMeaning
Plaintext and ciphertextReadable data and its encrypted form
CipherThe algorithm that encrypts and decrypts
KeyThe secret value that controls the cipher
Stream cipherEncrypts data one bit or byte at a time (RC4)
Block cipherEncrypts fixed size blocks (AES, DES)
Substitution and transpositionReplacing symbols, and rearranging their order
ConfidentialityOnly authorized parties can read the data
IntegrityThe data was not changed
AuthenticationThe sender or system is who it claims to be
Non-repudiationThe sender cannot deny the action later
Key escrowA copy of a key held by a trusted third party for recovery

Kerckhoffs's principle states that a system should stay secure even if everything except the key is public. This is why standard, published algorithms are preferred over secret ones.

Symmetric encryption

One shared secret key encrypts and decrypts. It is fast and suits bulk data, but the key must be shared securely.

AlgorithmBlock or streamKey sizeNotes
DESBlock, 64 bits56 bitsObsolete. Brute forced easily.
3DESBlock, 64 bits168 bit key (112 bits effective strength)Applies DES three times. Being retired.
AESBlock, 128 bits128, 192 or 256 bitsThe current standard, also called Rijndael
BlowfishBlock, 64 bits32 to 448 bitsFast, public domain
TwofishBlock, 128 bitsUp to 256 bitsSuccessor to Blowfish
RC4Stream40 to 2048 bitsDeprecated because of biases
RC5BlockVariableVariable block size, key size and rounds
IDEABlock, 64 bits128 bitsUsed in older PGP versions

Asymmetric encryption

A pair of keys is used. The public key can be shared, and the private key is kept secret. Data encrypted with the public key is decrypted only with the private key. It solves key distribution, but is slower, so it is often used to protect a symmetric session key.

AlgorithmPurposeNotes
RSAEncryption and signaturesBased on the difficulty of factoring the product of two large primes. 2048 bits or more is recommended.
Diffie-HellmanKey exchangeTwo parties agree on a shared secret over an open channel. Does not encrypt data itself.
DSASignaturesDigital Signature Algorithm
ECCEncryption, signatures, key exchangeElliptic curve cryptography. Shorter keys for the same strength.
ElGamalEncryption and signaturesBased on discrete logarithms

Hash functions

A hash function turns data of any size into a fixed length value. It is one way, so the original cannot be recovered, and a small change gives a very different hash. Hashes check integrity and store passwords.

HashOutput sizeStatus
MD5128 bitsBroken for collisions, avoid for security
SHA-1160 bitsDeprecated because collisions are practical
SHA-2224, 256, 384 or 512 bitsCurrent standard
SHA-3224 to 512 bitsLatest standard, built on a different design (Keccak)

A HMAC combines a hash with a secret key to provide integrity and authentication. A salt is random data added before hashing a password, so equal passwords give different hashes.

Digital signatures

A signature is made by hashing the message and encrypting the hash with the sender's private key. Anyone can check it with the sender's public key. It gives integrity, authentication and non-repudiation, but not confidentiality.

MessageHashdigestSign with private keyVerify with public keyrecipient

A worked example

Alice wants to send Bob a large file privately. She encrypts the file with a fresh AES key, because symmetric encryption is fast. She then encrypts that AES key with Bob's public RSA key and sends both.

Bob uses his private key to recover the AES key, and then decrypts the file. This hybrid design combines the speed of symmetric encryption with the key distribution of asymmetric encryption. If Alice also signs a hash of the file with her private key, Bob can confirm who sent it and that it was not changed.

How the exam asks about this

  • "Which symmetric algorithm uses a 56 bit key?" → DES.
  • "Which key does a recipient use to verify a digital signature?" → The sender's public key.
  • "What is the output size of SHA-256?" → 256 bits.

What to remember for the exam

  • Symmetric: one shared key, fast. Asymmetric: key pair, slower.
  • AES uses 128, 192 or 256 bit keys in 128 bit blocks.
  • RSA, DSA, ECC and Diffie-Hellman are asymmetric. Diffie-Hellman is for key exchange.
  • MD5 is 128 bits, SHA-1 is 160 bits, SHA-256 is 256 bits.
  • A signature uses the sender's private key to sign and the public key to verify.
Watch out

Hashing is not encryption. A hash cannot be reversed, so a question that asks for a way to recover original data from a hash is a trap.

Common mistakes

Encrypting with the private key for confidentiality. Confidentiality uses the recipient's public key, and signing uses the sender's private key.

Calling 3DES a 168 bit secure cipher. Its effective strength is lower, and it is being retired.

Expecting a hash to protect confidentiality. It protects integrity only.

Check yourself

  • Which key encrypts a message so only Bob can read it?

    Bob's public key.

  • What is a salt used for?

    It makes equal passwords produce different hashes and defeats precomputed tables.

  • Why do systems combine symmetric and asymmetric encryption?

    Symmetric encryption is fast for data, and asymmetric encryption safely shares the symmetric key.

Topic 1 of 3 in Cryptography

Test yourself on Cryptography

The full EC-Council 312-50 question bank has 1,000 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.