Cryptography Basics: Symmetric, Asymmetric, Hashing & Digital Signatures

This article introduces fundamental cryptography concepts, explaining how symmetric and asymmetric encryption work, the role of key exchange, the purpose and properties of hashing algorithms, and how digital signatures combine encryption and hashing to ensure data authenticity and integrity.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Cryptography Basics: Symmetric, Asymmetric, Hashing & Digital Signatures

Introduction

Cryptography converts plaintext (input) into ciphertext (output) . Most algorithms require a key for encryption and decryption. The key is a sequence of characters used by the algorithm. Ciphertext can be stored and transmitted securely, readable only by the intended parties.

Encryption methods are divided into three categories:

Symmetric Encryption

Asymmetric Encryption

Hashing

Symmetric Encryption

Example of encrypting and decrypting the word “FILM”.

Symmetric encryption is fast, making it suitable for speed‑critical use cases such as VPNs and data streams. The two most common symmetric algorithms are:

AES

DES

Key Exchange

In symmetric encryption, a major challenge is securely sharing the key between parties.

Diffie‑Hellman (1976) was the first solution, allowing two participants to generate a shared secret without a pre‑shared key.

Agree on a public value.

Select a private (secret) value.

Exchange the value computed from the public and private values.

Each party combines the exchanged value with its own private value to derive the same secret key.

Hybrid systems combine symmetric and asymmetric encryption: asymmetric encryption secures the symmetric key, while symmetric encryption handles the bulk data because it is faster.

Asymmetric Encryption

Asymmetric encryption uses a key pair consisting of a public key and a private key. The public key encrypts data; only the corresponding private key can decrypt it. The public key can be shared openly, while the private key must remain secret.

Receiver shares the public key.

Sender encrypts data with the public key.

Encrypted data (ciphertext) is sent to the receiver.

Receiver decrypts the ciphertext with the private key.

Advantages: public keys can be shared without prior secure channels. Disadvantage: asymmetric encryption is slower. Common algorithms include:

RSA

ECC

Hashing

Hash algorithms generate a unique, fixed‑length string (a hash) from input data. Required properties:

Fixed‑length output.

One‑way function: easy to compute, hard to reverse.

Collision resistance: difficult to find two inputs with the same output.

Popular hash algorithms today:

SHA‑2 (Secure Hash Algorithm 2)

SHA‑3 (Secure Hash Algorithm 3)

MD5 (Message‑Digest Algorithm 5) – should no longer be used

bcrypt – primarily for password hashing

Example hash values:

Input Foo hashed with SHA‑3:

195e5c2ddf90d08e0c12357a75fd11180c85b989a9d3b6bc3327aa23a98f278a

bcrypt hash:

$2a$12$.LJ6zlZXAZ2iRIyzRMcvpeQsPJ6pJ0/zb0daxnhxeGXNqN4KmJ9ny

MD5 hash:

1356c67d7ad1638d816bfb822dd2c25d

Digital Signatures

Digital signatures verify the authenticity of data and documents by combining asymmetric encryption with hashing.

Compute the hash of the document to be signed.

Encrypt the hash with the sender’s private key.

Attach the encrypted hash to the document, forming the signed document.

To verify a signed document:

Decrypt the attached hash using the sender’s public key.

Compute the hash of the received document.

Compare the decrypted hash with the newly computed hash; a match means the signature is valid.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

encryptionHashingcryptographykey exchangedigital signatures
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.