Cryptography Tutorial

โšก Smart Summary

Cryptography protects information by transforming it into a non-human-readable form that only a holder of the correct key can reverse, and this page covers its features, applications, algorithms, and a hands-on CrypTool exercise.

  • ๐Ÿ” Core idea: Encryption converts plaintext into a cipher; decryption reverses it using a secret key.
  • ๐Ÿงฉ Three disciplines: Cryptography hides meaning, cryptanalysis breaks it, and cryptology covers both.
  • ๐Ÿ“ Algorithm families: Hash functions, symmetric ciphers, and public-key systems solve different problems.
  • โœ… Current standards: AES and SHA-2 remain approved, while MD5, SHA-1, and RC4 are considered broken.
  • ๐Ÿงช Hands-on practice: CrypTool 1 demonstrates RC4 encryption and brute-force analysis of a 24-bit key.
  • ๐Ÿ”ฎ Looking ahead: NIST published its first post-quantum standards in August 2024.

Cryptography Tutorial

Information plays a vital role in business, government, and military operations, and information in the wrong hands can cost revenue or worse. To secure communication, an organization uses cryptology to cipher information โ€” transforming it into a non-human-readable format and back again.

In this cryptography and network security article, you will learn how cryptology works and how to keep information out of the wrong hands.

What is Cryptography?

Cryptography is the study and application of techniques that hide the real meaning of information by transforming it into non-human-readable formats and back again.

Consider an example. To send “I LOVE APPLES”, you replace every letter with the third successive letter of the alphabet, producing “K NQXG CRRNGU”. To read it, the recipient steps three letters back, as shown below.

Cipher encryption and decryption shifting each letter three places
Cipher Encryption and Decryption

Turning information into non-human-readable form is called encryption, and reversing it is called decryption. The encrypted result is known as a cipher.

Decryption uses a secret key known only to the legitimate recipients. Because the key is required, communication stays secure even when an attacker intercepts the cipher, which makes no sense without it.

Features of Cryptography

A cryptographic system is judged on the characteristics below.

Feature What it means
Algorithm The published mathematical procedure performing the transformation.
Confidentiality Only holders of the key can read the protected data.
Integrity Any change to the data is detectable.
Adaptability The scheme tunes to different key sizes and threat levels.
Interoperability Different systems and vendors exchange protected data.
Authentication The origin of a message can be proven.
Scalability Performance holds up as data volumes grow.
Key Management Keys are generated, stored, rotated, and retired safely.

Applications of Cryptography

Those characteristics become everyday services people rely on without noticing.

Application How cryptography is used
TLS encryption Protects traffic between a browser and a website.
Password storage Stores salted hashes instead of readable passwords.
Online banking Secures transactions and verifies the bank.
Cryptocurrency Signs transactions and links blocks with hashes.
Encrypted email Keeps message contents private in transit and storage.
Digital signatures Proves authorship and that a document is unchanged.
Secure messaging Applies end-to-end encryption between devices.
E-commerce Protects card details during checkout.

What is Cryptanalysis?

Cryptanalysis is the art of decrypting messages without the key used to encrypt them. It applies mathematical analysis and algorithms to decipher ciphers, and it is used both to breach systems and, defensively, to measure how much protection an algorithm offers.

The success of a cryptanalysis attack depends on:

  • Amount of time available
  • Computing power available
  • Storage capacity available

The following are the commonly discussed cryptanalysis attacks:

  • Brute force attack โ€” tries every possible combination of the plaintext or key, ciphering each one and comparing it against the original cipher.
  • Dictionary attack โ€” uses a wordlist to match either the plaintext or the key. It is mostly used when trying to crack encrypted passwords.
  • Rainbow table attack โ€” compares the ciphertext against pre-computed hashes to find matches. Salting each stored password defeats it.

What is Cryptology?

Cryptology is the umbrella field combining cryptography and cryptanalysis. Both halves matter: an algorithm is trusted only once cryptanalysts have tried and failed to break it.

Encryption Algorithms

The algorithms below appear repeatedly in security work. Note which remain approved and which survive only in legacy systems.

  • MD5 โ€” short for Message-Digest 5, it produces 128-bit hash values. MD5 is a hash function rather than encryption, so it cannot be reversed by design. It is not collision resistant โ€” two different inputs can produce the same hash โ€” and is unfit for passwords or signatures.
  • SHA โ€” short for Secure Hash Algorithm, this family generates condensed representations of a message, called a message digest:
    • SHA-0: produces 160-bit hash values. It was withdrawn for a significant flaw and replaced by SHA-1.
    • SHA-1: produces 160-bit hash values. A practical collision was demonstrated in 2017 and NIST disallowed it for digital signatures, so avoid it.
    • SHA-2: a family of six functions including SHA-256 and SHA-512, working on 32-bit and 64-bit words respectively. Both remain approved.
    • SHA-3: standardized in 2015 and formerly known as Keccak, it uses a different internal design as a backup to SHA-2.
  • AES โ€” the Advanced Encryption Standard is the symmetric block cipher protecting most data at rest and in transit today, with 128-, 192-, and 256-bit keys. It replaced DES and is the default for new systems.
  • RC4 โ€” a stream cipher once common in Secure Sockets Layer (SSL) and Wired Equivalent Privacy (WEP). Both protocols are obsolete, and RFC 7465 prohibited RC4 in every version of TLS in 2015. It survives here as a teaching example.
  • Blowfish โ€” a keyed symmetric block cipher used historically for passwords and files. Its 64-bit block size makes AES the better modern choice.

Looking ahead, NIST published its first post-quantum standards in August 2024 โ€” ML-KEM for key exchange, ML-DSA and SLH-DSA for signatures โ€” which will gradually replace today’s public-key algorithms.

Hacking Activity: How to Create a Cipher Using CrypTool

In this practical CrypTool exercise, you create a simple cipher with RC4 and then recover it with a brute-force analysis, assuming the key is known to be 24 bits. The point is to show why a short key and a broken cipher offer no real protection.

Creating the RC4 Stream Cipher

Step 1) Download and install CrypTool

CrypTool 1 is an open-source educational tool for cryptology. Active development has since moved to CrypTool 2, but release 1.4.42 still runs on Windows and matches the screens below. Download it from cryptool.org.

Step 2) Open CrypTool and replace the text

The phrase to encrypt is Never underestimate the determination of a kid who is time-rich and cash-poor. The key is 00 00 00.

  • Open CrypTool 1.

CrypTool 1 main window before the sample text is replaced

  • Replace the text with the phrase above.

CrypTool document containing the replacement phrase

Step 3) Encrypt the text

  • Click the Encrypt/Decrypt menu.

CrypTool Encrypt slash Decrypt menu with Symmetric modern selected

  • Point to Symmetric (modern), then select RC4.

CrypTool RC4 key entry dialog

Step 4) Select the encryption key

  • Select 24 bits as the key length.
  • Set the value to 00 00 00.
  • Click Encrypt to produce the stream cipher below.

Resulting RC4 stream cipher shown in CrypTool

Attacking the Stream Cipher

Step 5) Start the analysis

  • Click the Analysis menu.

CrypTool Analysis menu with Symmetric Encryption modern highlighted

  • Point to Symmetric Encryption (modern), then select RC4.

CrypTool brute-force analysis dialog for RC4

  • The assumption is a 24-bit secret key, so select 24 bits as the key length.
  • Click Start.

CrypTool brute-force analysis progress window

  • Note: the time taken depends on the processing capacity of the machine being used and on the key length. A longer key takes longer, which is why modern keys are 128 bits or more.

Step 6) Analyze the results

  • When the analysis finishes, candidate keys appear ranked as follows.

CrypTool brute-force results ranked by entropy

  • Note: a lower entropy value usually indicates the correct result, though a higher one can be right.
  • Select the line that reads as sensible text, then click Accept selection.

FAQs

Symmetric encryption uses one shared key and is fast, so it protects bulk data. Asymmetric encryption uses a public and private key pair, which solves key distribution and enables digital signatures.

No. Encryption is reversible with a key; hashing is a one-way transformation to a fixed-length digest. Password systems store salted hashes precisely because the original value cannot be recovered.

A salt is a unique random value stored beside each password hash. It makes identical passwords hash differently, defeating pre-computed rainbow tables and forcing an attacker to work on every account separately.

A digital certificate binds a public key to a verified identity and is signed by a certificate authority. Browsers check that signature before trusting the encrypted connection to a website.

A large quantum computer would break RSA and elliptic-curve keys, while symmetric ciphers need only larger keys. NIST answered by publishing post-quantum standards in 2024 so migration can start early.

Machine learning does not break strong modern ciphers. It is used instead for side-channel analysis, spotting weak or reused keys at scale, and flagging anomalous encrypted traffic during threat detection.

Copilot speeds up boilerplate but often suggests outdated algorithms or hard-coded keys. Treat every suggestion as a draft, prefer a vetted library over hand-rolled code, and have a reviewer check key handling.

Security engineers, penetration testers, and forensic analysts apply it daily, and it forms a full domain of the CISSP certification. Most roles configure vetted libraries rather than design algorithms.

Summarize this post with: