General Security Concepts 12% of Exam Lesson 8 of 11

Cryptography Basics: Encryption, Hashing, and How They Protect Data

Avatar Of Mudassir KMudassir K ·Oct 4, 2026 ·39 min read
73% through domain
Cryptography Basics Showing Encryption, Hashing, Keys, And Security Goals For Comptia Security+ Sy0-701
COMPTIA SECURITY+ SY0-701 · DOMAIN 1.0 · LESSON 01.8
Cryptography Basics · Encryption, Hashing, and Practical Data Protection
WHAT YOU’LL LEARN
  • How cryptography supports confidentiality, integrity, authentication, and non-repudiation.
  • How encryption, hashing, encoding, tokenization, data masking, and steganography differ.
  • How encryption protects data at rest and in transit, including disk, volume, database, file, and field-level encryption.
  • Why password storage requires unique salts and a suitable password-hashing or key-stretching design.
  • What key length, key exchange, hybrid encryption, and key lifecycle management mean.
  • How TPMs, HSMs, KMS platforms, and secure enclaves help protect cryptographic keys.
  • How to recognize cryptography clues in Security+ SY0-701 scenarios.

What Is Cryptography?

Cryptography uses mathematical methods, algorithms, keys, and protocols to protect information and enable trusted digital communication. Depending on the technique and its implementation, cryptography can support confidentiality, integrity, authentication, and non-repudiation.

For Security+ scenarios, identify the security objective before selecting a technique. Encryption is primarily associated with confidentiality. Cryptographic hashing helps verify integrity. Password-hashing systems help verify passwords without storing them as readable plaintext. Digital signatures can support integrity, origin authentication, and non-repudiation when keys and supporting processes are trustworthy.

Core exam rule

Encryption: protect confidentiality.

Hashing: produce a digest for verification and integrity-related uses.

Password hashing: verify a password without storing the original password.

Digital signatures: help verify content integrity and the signer associated with a signature.

A hash is not ciphertext that can simply be decrypted into the original data.

The Basic Cryptography Vocabulary

TermMeaningSecurity+ Clue
PlaintextOriginal readable or usable data before encryption.Before encryption
CiphertextData produced by encryption.Requires the appropriate key and decryption process for recovery.
Cryptographic keyA value used by a cryptographic algorithm.Key protection is essential.
Hash / digestFixed-length output produced by a hash function.Integrity verification or password-verification design
AlgorithmThe mathematical procedure used for a cryptographic operation.AES, RSA, SHA-256, and related names
SaltA unique value included in password-hashing input.Helps prevent identical passwords from producing identical stored verifier values.
Key exchange / agreementA process for establishing shared keying material.Session setup is not the same operation as encrypting every message.

Encryption: Protecting Data Confidentiality

Encryption transforms plaintext into ciphertext using a cryptographic algorithm and key. Authorized users or systems can recover the data with the appropriate decryption process if they possess the required keying material and permissions.

Encryption is designed to protect confidentiality. Someone who copies encrypted information should not be able to understand its contents merely by reading the ciphertext. Real protection also depends on secure key management, suitable algorithms, correct implementation, and appropriate configuration.

Encryption Fundamentals Showing Plaintext, Ciphertext, Data At Rest, Data In Transit, And Practical Security+ Examples
Encryption protects confidentiality by transforming plaintext into ciphertext and using appropriate keying material for authorized recovery.

Data at Rest

Data at rest is information stored on a device or storage system rather than actively moving across a network. Examples include laptop drives, file servers, databases, removable media, cloud storage, and backups.

Encryption at rest can reduce the impact of a stolen laptop or copied storage device. Its effectiveness depends on how keys are protected and whether an attacker can access the device while it is already unlocked or the data is available to an authenticated session.

Common Encryption Scopes

FULL DRIVE

Full-disk encryption

Protects the contents of a drive. Common for laptops and workstations that may be lost or stolen.

STORAGE VOLUME

Volume encryption

Protects a logical storage volume or partition. A device can have separate encrypted volumes.

SELECTED CONTENT

File or folder encryption

Protects selected files or directories instead of necessarily encrypting the entire drive.

DATABASE

Database encryption

Protects database storage or selected database content, depending on the design.

GRANULAR DATA

Record or field-level encryption

Protects selected records, columns, or fields when specific values need their own protection boundary.

PORTABLE COPIES

Backup and removable-media encryption

Protects backup sets, external drives, and portable media if they are misplaced or accessed without authorization.

Data in Transit

Data in transit is information moving between systems. Examples include browser-to-server traffic, application-to-database connections, remote-access sessions, and transfers across public or private networks.

Technologies such as TLS and VPNs can use cryptographic mechanisms to protect communications in transit. When a scenario requires information to remain private while travelling, think encryption and confidentiality.

STORED INFORMATION

Data at rest

Information stored on a disk, in a database, in cloud storage, or in a backup.

Exam clue: disk, file, volume, database, or field encryption.

MOVING INFORMATION

Data in transit

Information travelling between endpoints over a network.

Exam clue: TLS, a protected VPN connection, or secure transport.

Hashing: Protecting Integrity and Verifying Data

A cryptographic hash function accepts input data and produces a fixed-length output called a hash value or digest. For a suitable modern hash function, even a small input change should produce a substantially different digest with overwhelming probability.

SHA-256 belongs to the SHA-2 family. A trusted digest can help an administrator detect whether a downloaded file differs from the version represented by that digest. The comparison is useful only when the reference digest itself comes from a trustworthy source.

Hashing And Salting Infographic Explaining Sha-256 Digests, File Integrity Verification, Password Hashing, And Hashing Versus Encryption
Hashing produces a fixed-length digest for verification; password salts make stored password hashes harder to attack using precomputed tables.

The Avalanche Effect

A useful hash-function property is that a small input change should result in a substantially different digest. If one character in a downloaded file changes, the newly calculated digest should differ from the trusted digest. Security tools can compare these values to help detect modification or corruption.

One-Way Behavior and Collision Resistance

One-way behavior means it should be computationally infeasible to recover the original input from the digest alone. Collision resistance means it should be computationally infeasible to find two different inputs that produce the same digest.

These are distinct properties. A hash function is not a normal decryption mechanism, and collision resistance is not a promise that collisions are mathematically impossible.

Security+ trap: hashing is not encryption

Hashing produces a digest for verification. Encryption is designed to let an authorized party recover protected plaintext. Do not choose hashing when the scenario says the original information must later be decrypted.

PropertyEncryptionCryptographic hashing
Primary objectiveConfidentialityIntegrity verification and related security functions
OutputCiphertextFixed-length digest
Normal recoveryDesigned for authorized decryptionNot designed to be decrypted into the original input
ExamplesAES-based storage encryption, TLS-protected communicationSHA-256 file verification, digest generation

Salting and Secure Password Storage

Applications should not normally store users’ passwords as readable plaintext. A secure password-storage design stores a verifier produced with a suitable password-hashing function, rather than keeping the original password for later retrieval.

What Is a Salt?

A salt is a unique value added to the input before password hashing. A different salt means the same password can produce different stored verifier values in different accounts. Salts also make precomputed lookup tables less useful against a collection of independently salted password hashes.

Important distinction

A salt is not the user’s password and does not need to function as a secret encryption key. It does not replace a suitable password-hashing function. Its purpose is to make password-hash attacks more expensive and prevent simple reuse of precomputed results across accounts.

What Is Key Stretching?

Key stretching makes password-based guessing more computationally expensive by applying a deliberately costly derivation process. Depending on the algorithm, a password-storage or key-derivation design may use work factors, iteration counts, memory costs, or a combination of these.

  • PBKDF2: a password-based key derivation function that uses repeated processing controlled by an iteration count.
  • bcrypt: an adaptive password-hashing function with a configurable work factor.
  • Argon2: a password-hashing family designed to make password guessing more expensive; Argon2id is a commonly considered variant.

For password storage, the algorithm, work factor, implementation, and salt all matter. A fast general-purpose digest such as SHA-256 alone is not a substitute for a suitable password-hashing design.

Use caseGoalKey consideration
File verificationHelp detect changesCompare the calculated digest against a trusted reference.
Password storageVerify a password without storing it in plaintextUse suitable password hashing and a unique salt.
Password-based key derivationDerive key material from a password or passphraseUse an appropriate derivation function and parameters.
Digital-signature workflowBind signed content to integrity and signer-key evidenceHashing is combined with asymmetric signature operations.

Symmetric and Asymmetric Cryptography: The Basic Difference

Symmetric cryptography uses the same shared secret key for encryption and decryption. Asymmetric cryptography uses a mathematically related public/private key pair. These approaches solve related but different problems.

SYMMETRIC

One shared secret key

  • Generally efficient for large amounts of data.
  • AES is an important example.
  • The shared key must be protected and established securely.
ASYMMETRIC

Public and private key pair

  • Supports public-key operations.
  • Used with digital signatures and certificates.
  • Can participate in key establishment, depending on the protocol.

This lesson covers the foundational distinction. Continue with Symmetric vs. Asymmetric Encryption for algorithms, use cases, and hybrid approaches.

Hybrid Encryption and Key Exchange

Real-world protocols often combine cryptographic techniques. A protocol can use asymmetric cryptography or a key-agreement method to establish shared session key material, then use symmetric cryptography to protect bulk session data efficiently.

Key exchange or key agreement is about establishing keying material; it is not the same operation as encrypting every application message. In modern TLS configurations, ephemeral key agreement can also support perfect forward secrecy, helping protect past sessions against later compromise of a long-term authentication key when the protocol and implementation provide that property.

Exam clue: hybrid design

When a scenario mentions secure session setup followed by efficient protection of large volumes of data, recognize the combination of key establishment and symmetric session encryption.

Cryptographic Algorithms and Key Length

An algorithm and its key length both influence security, but a larger key size does not automatically make every system secure. Algorithm design, attack history, protocol, implementation, key generation, and key management all matter.

NameFunction / familyStudy point
AESSymmetric encryptionA widely used modern encryption algorithm; 128-bit and 256-bit key sizes are common examples.
RSAAsymmetric cryptographyRecognize public/private key operations; key sizes and uses should follow current guidance.
ECCElliptic-curve cryptographySupports public-key operations and can provide comparable security strength with smaller keys than some alternatives.
SHA-256Cryptographic hash functionProduces a 256-bit digest; it is not an encryption algorithm.
MD5 and SHA-1Legacy hash functionsDo not treat them as preferred choices where modern collision resistance is required.

Organizations should select approved algorithms and key sizes that meet their requirements and current standards. Deprecated algorithms, weak configuration, poor random-number generation, and exposed keys can undermine a design even when another component appears strong.

Cryptographic Key Management

Cryptography can fail if keys are not managed properly. Key management includes key generation, storage, distribution or establishment, use, rotation, revocation, backup where appropriate, and secure destruction.

Cryptographic Key Management Lifecycle Showing Key Generation, Protection, Use, Rotation, Revocation, And Destruction
Cryptographic security depends on protecting keys throughout their lifecycle, not merely choosing a strong algorithm.
1Generate

Use an appropriate, secure generation process.

2Protect

Limit access and secure key storage.

3Use and rotate

Follow lifecycle rules, permissions, and rotation requirements.

4Revoke and destroy

Retire keys when compromised or no longer needed.

TPM vs. HSM vs. KMS vs. Secure Enclave

These terms describe related but different ways of protecting and managing keys. They should not be treated as interchangeable.

TechnologyWhat it doesTypical scenario clue
TPMA trusted platform module provides hardware-backed functions for protecting keys and supporting platform measurements and integrity features.A computer uses hardware-rooted trust, secure boot, or drive-protection features.
HSMA hardware security module is a dedicated device or appliance designed to protect cryptographic keys and perform cryptographic operations.An organization needs dedicated, high-assurance protection for signing or encryption keys.
KMSA key management service or system manages key lifecycle operations, access policies, rotation, and application integration. It may use HSM-backed protection.A cloud or enterprise environment centrally manages keys for many workloads.
Secure enclave / trusted execution environmentA protected execution area designed to isolate sensitive operations or material, depending on the platform.A device isolates sensitive key operations or credentials from ordinary application execution.

Why Key Protection Matters

If an attacker obtains the relevant decryption key, encryption may no longer protect the data from that attacker. Good key protection includes least-privilege access, secure storage, auditing, recovery arrangements, rotation or revocation procedures, and controls for compromised or retired keys.

Key escrow means retaining key material or recovery capability under controlled conditions so it can be recovered under defined circumstances. Weak access controls and governance can make escrow a security risk. Certificate authorities and certificate lifecycle details are covered separately in the Public Key Infrastructure (PKI) lesson.

Encryption vs. Other Forms of Data Protection

Some techniques reduce exposure or change how information is represented without performing conventional encryption. Identify the actual protection goal when these terms appear in Security+ scenarios.

REPRESENTATION

Encoding

Changes data representation for transport, storage, or compatibility. Base64 is an example. Encoding does not provide confidentiality by itself.

HIDE A MESSAGE

Steganography

Hides the existence of a message inside a carrier, such as an image or audio file. It does not necessarily encrypt the message.

SUBSTITUTE A VALUE

Tokenization

Replaces a sensitive value with a token that maps back to the original through a protected system. A token is not simply decryptable ciphertext.

OBSCURE DISPLAYED DATA

Data masking

Conceals all or part of sensitive data in a display or dataset, often for testing, demonstrations, or limited-access workflows.

Common exam trap

Base64 is encoding, steganography hides the existence of information, tokenization substitutes a value, and data masking obscures data. None should automatically be chosen as a substitute for encryption when cryptographic confidentiality is required.

Blockchain, Hashes, and Public Ledgers

A blockchain is a type of distributed ledger that commonly links blocks using cryptographic hashes and may use digital signatures to authenticate transactions. Consensus and governance mechanisms help participating systems agree on ledger state.

Hash-linked blocks can make changes to previously recorded data detectable because changing a block can affect subsequent hash links. However, blockchain does not make tampering mathematically impossible, guarantee that the original data was truthful, or automatically make public ledger entries confidential.

  • Hashes: help link records and make certain modifications detectable.
  • Digital signatures: can help associate a transaction with control of a signing key.
  • Consensus: helps participating nodes agree on accepted ledger state under the system’s rules.
  • Confidentiality: is separate. Public availability can expose transaction information unless additional privacy measures are used.

Cryptography and Security Goals

Security goalCryptographic techniqueExample
ConfidentialityEncryptionEncrypted laptop storage or protected network traffic
IntegrityHashing, message authentication codes, digital signaturesDetecting unexpected file changes or verifying a signed release
AuthenticationCertificates, digital signatures, and other mechanismsVerifying the identity associated with a trusted server certificate or signature
Non-repudiationDigital signatures plus trustworthy identity, key control, and supporting evidenceProviding evidence that content was signed using a particular private key

Cryptographic mechanisms support these goals, but do not automatically guarantee them in every situation. A digital signature does not prove that signed content is factually true or that the signing key was never compromised. Key trust, implementation, and supporting processes matter.

Common Cryptography Mistakes

Using encoding instead of encryptionBase64 changes representation but does not keep data confidential.
Using hashing when data must be recoveredA hash digest is not designed for normal decryption.
Protecting the algorithm but not the keyKey compromise can defeat expected protection.
Storing passwords in plaintextUse appropriate password hashing, unique salts, and suitable work factors.
Assuming a salt is a secret keyA salt makes password-hash attacks harder through unique input; it does not replace a suitable hash design.
Confusing tokenization with encryptionTokenization substitutes a value and depends on a protected token-to-value mapping.
Assuming blockchain automatically provides confidentialityLedger integrity properties and privacy are different concerns.
Ignoring key lifecycle managementCompromised, expired, or unnecessary keys need appropriate rotation, revocation, recovery, or destruction.

Security+ Scenario Strategy

Identify the requirement first, then match the technique to the problem. Pay attention to words such as protect, detect, verify, hide, replace, establish, and recover; they can point to different solutions.

Keep data unreadableEncryption → confidentiality
Detect changed dataHashing or another suitable integrity mechanism
Store passwords safelyUnique salt + suitable password hashing / key stretching
Establish a session keyKey exchange / agreement in a suitable protocol
Protect keys in hardwareTPM, HSM, or secure environment, depending on the scenario
Hide or substitute a valueDistinguish steganography, tokenization, or masking from encryption

For additional context, review Non-Repudiation and Digital Signatures and the CIA Triad. Continue with the Security+ SY0-701 guide hub for the complete series.

Practice Questions

10 scenario-based questions. Expand each card to reveal the answer and explanation.

Cryptography Basics Exam Quiz

Article 01.8 · 15 multiple-choice questions · 10 minutes · questions and answer options shuffled on each attempt.

Ready to test your understanding?

This exam covers encryption, hashing, salting, key stretching, key management, hardware key protection, and common cryptography traps.

📋

15 Questions

Lesson-specific topics

⏱️

10 Minutes

Timed attempt

💡

Instant Feedback

Answer explanations

📊

Full Review

All questions at end

Lesson 01.8 — Summary

Cryptography Basics: Encryption, Hashing, and How They Protect Data
Module 01: General Security Concepts · Domain 1.0 · Exam domain weight: 12%

Module 01 · Lesson 01.8 General Security Concepts 12% Domain Weight

Key Takeaways

ENCRYPTION
Plaintext → ciphertext. Primarily protects confidentiality.
HASHING
Input → fixed-length digest. Supports verification and integrity-related functions.
PASSWORD SECURITY
Unique salt + suitable password hashing. Key stretching raises the cost of guessing.
KEY DISTINCTION
Shared secret vs. key pair. Know the foundational difference between symmetric and asymmetric cryptography.
KEY MANAGEMENT
Generate, protect, use, rotate, revoke, and destroy. Protect keys through their lifecycle.
DATA PROTECTION
Encryption, masking, tokenization, encoding, and steganography differ. Match the technique to the requirement.
ConceptPrimary ideaExam clue
EncryptionConfidentialityKeep information unreadable to unauthorized users.
HashingIntegrity / verificationDetect data changes or compare digests.
SaltPassword protectionDifferent salted verifiers for identical passwords.
Key stretchingRaise password-guessing costWork factor, iterations, or memory cost.
SymmetricShared secretEfficient bulk data encryption.
AsymmetricPublic/private key pairSignatures, certificates, or key establishment.
Key managementLifecycle controlGenerate, store, protect, rotate, revoke, and destroy.
TPM / HSM / KMSKey protection or managementMatch device, dedicated hardware, or service to the scenario.
Tokenization / maskingSubstitute or obscure sensitive valuesNot automatically encryption.
BlockchainDistributed ledger with cryptographic techniquesTamper evidence is not confidentiality or guaranteed truth.

Exam Tips — Lesson 01.8

  • Unreadable to unauthorized users → encryption and confidentiality.
  • Detect changes or compare a digest → hashing and integrity verification.
  • Identical passwords with different verifier values → unique salts.
  • Make password guesses more costly → suitable password hashing and key stretching.
  • Public/private key pair → asymmetric cryptography.
  • Dedicated hardware for key protection → HSM; device hardware root of trust can indicate TPM.
  • Hide a message inside an image → steganography, not necessarily encryption.

Common Pitfalls

❌
Hash = encrypted data — A hash is a digest, not normal ciphertext.
❌
Base64 = encryption — Encoding does not provide confidentiality.
❌
A salt must be secret — Its purpose is unique input for password hashing, not acting as an encryption key.
❌
Strong algorithm means keys do not matter — Key protection and lifecycle management are fundamental.
❌
Blockchain guarantees privacy — Public ledger data may still be visible.

Security+ SY0-701 Exam Domains

01General Security Concepts12%
02Threats, Vulnerabilities & Mitigations22%
03Security Architecture18%
04Security Operations28%
05Security Program Management & Oversight20%

Security Frameworks remains a supplementary guide rather than a numbered lesson in the core ten-lesson sequence.

Further Reading and Related Guides

Continue learning on NetworkUstad:

External references:

Avatar Of Mudassir K

Holds a BS in Computer Science with 6+ years of experience writing about technology. Covers AI, cloud computing, web development, and SEO, drawing on hands-on project experience to make advanced topics accessible.