← Back to list

Introduction to Cryptography Concepts

Cryptography is vital in safeguarding sensitive information in today’s digital world. Whether it’s secure messaging apps, online banking…

Esteban Garcia · 2024-10-09 05:55 · 0 claps · 4.7 min read
#digital-signatures #hash-function #cryptography #introduction
Open on Medium ↗
Wiki topics: CRY · Crypto & Web3 ECO · Economy · General 🔒 · Cybersecurity 🏔️ · Outdoor & Adventure

Introduction to Cryptography Concepts

Cryptography is vital in safeguarding sensitive information in today’s digital world. Whether it’s secure messaging apps, online banking, digital identity, or blockchain transactions, cryptography ensures our data stays private and unchanged. For those unfamiliar with technical jargon, this post aims to simplify and explain the basics of cryptography in an accessible way. We’ll explore three fundamental aspects of cryptography: hash functions, cryptography itself, and digital signatures. We’ll break down what they are and how they work, all explained in straightforward terms for a non-technical audience.

Hash Functions

A hash function is a mathematical algorithm that takes an input, like a text message or a digital file (picture, PDF, video, etc.), and produces a fixed-size output called a hash code. This output is unique to the input data, often called a “digital fingerprint.” The defining properties of hash functions include:

  • Deterministic Output: Given the same input, the hash function will always produce the same output. This property ensures consistent results no matter who or when the function is used, as long as the input is the same.
  • Fixed Length: The hash code is always the same length regardless of the input size. For example, the SHA-256 hash function produces a 64-character (256-bit) hash code irrespective of whether the input is a small text or a large file.
  • Pre-Image Resistance: Determining the original input given only the hash code is practically impossible.
  • Avalanche Effect: A slight change in the input will produce a significantly different hash code.

For example:

1) sha256("Hello World!")
   Output: 7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069

2) sha256("Hello World?")
   Output: 8a0b7c6635f51f10710decaa6fd58fdd9fa3a5aae4df8a96f949fea7cf614970

3) sha256("Hello World!")
   Output: 7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069

4) sha256("Hola")
   Output: e633f4fc79badea1dc5db970cf397c8248bac47cc3acf9915ba60b5d76b0e88f

Notable observations:

  • In examples 1 and 2, replacing “!” with “?” completely changes the resulting hash code, indicating that the input has been altered.
  • Examples 1 and 3 show that identical inputs produce identical hash codes.
  • Example 4 demonstrates that the hash code is the same fixed length even for a shorter message.

These properties make hash functions ideal for securing and detecting tampering in digital data. For example:

  • In password storage, hash functions transform a user’s password into a unique string of characters (the hash code) stored in a database instead of the actual password. When a user logs in, the system hashes the entered password and compares it to the stored hash. If the hashes match, the password is correct. This ensures that even if someone gains unauthorized access to the database, they cannot retrieve the original passwords because the hashing process is practically irreversible.
  • Hash functions are also used in file integrity checks to ensure files have not been altered and in blockchain technology to validate data integrity and maintain the security of the entire chain.

Cryptography

Cryptography is the science of securing communication by altering messages so they can only be understood by the intended recipient. The name originates from the Greek words for “hidden writing.” Cryptography involves techniques such as encryption, decryption, and key management.

One well-known example of a basic encryption method is the Caesar Cipher. This method involves shifting the letters of the alphabet by a certain number of positions. For instance, shifting the entire alphabet by 3 letters turns “A” into “D,” “B” into “E,” and so on. The number of positions shifted is called the key.

Plain alphabet:   A B C D E F G H I J K L M N O …
Encoded 3 spaces: D E F G H I J K L M N O P Q R …

To encrypt a message using the Caesar Cipher, each letter in the message is shifted by the value of the key. For example, if the key is 3, “HELLO” becomes “KHOOR.”

To decrypt the message, the recipient must know the key, allowing them to shift each letter backward by the same number of positions. Using the key of 3, “KHOOR” shifts back to “HELLO.” This simple mechanism demonstrates how the key is essential for both encryption and decryption and why a secure management of the key is crucial to maintain the secrecy.

While the Caesar Cipher is a simple encryption method, it serves as an introduction to the concept. Modern cryptographic methods are far more complex, relying on advanced mathematical algorithms to ensure security against potential attackers.

Distinguishing Encryption from Hashing

It’s important to distinguish between encryption and hashing. While both techniques transform data, they serve different purposes:

  • Encryption: is reversible and used to secure data so it can be returned to its original state.
  • Hashing: is irreversible and primarily used for data tampering verification, and to represent a piece of data without having the data.

Encryption is like locking information in a safe that only the correct key can unlock while hashing is like creating a unique fingerprint of a piece of data.

Types of cryptography

Modern cryptography can be categorized into two main types:

  • Symmetric Cryptography: The same key is used for both encryption and decryption (e.g., the Caesar Cipher).
  • Asymmetric Cryptography: This method uses a pair of related keys: a public key for encryption and a private key for decryption. These keys can switch roles in certain scenarios, such as digital signatures. A crucial aspect of this method is ensuring the private key remains secure and confidential, as losing it means losing access to encrypted data. Moreover, if someone else gains access to the private key, the security of the data is compromised. The public key, on the other hand, can be freely shared. Sharing the public key allows others to encrypt messages or verify signatures without any security risks. RSA is one of the most well-known algorithms implementing asymmetric cryptography.

Digital Signatures

A digital signature is a mechanism used to verify the authenticity and integrity of digital data. In purpose, it is similar to a handwritten signature but is generated using cryptographic algorithms, making it more secure and harder to forge.

Digital signatures combine hash functions and asymmetric cryptography. Here’s how they work:

  • Public Key Sharing: The sender must share their public key with the recipient beforehand. This key allows the recipient to decrypt the signature and verify the message’s authenticity. Public keys are generally shared openly, as they cannot be used to create signatures, only to verify them.
  • Generation: The sender generates a hash code of the message and uses their private key to encrypt it, creating the digital signature. The message and the signature are sent together. Encrypting the hash with the sender’s private key binds the signature to the sender, ensuring authenticity.
  • Verification: The recipient decrypts the signature using the sender’s public key, revealing the hash code, and then generates the hash of the received message. If the hashes match, the message is verified as authentic and unchanged.

Digital signatures provide:

  • Integrity: Ensuring the message has not been tampered with.
  • Authenticity: Verifying the identity of the sender.
  • Non-repudiation: Preventing the sender from denying they sent the message.

I hope this blog post has provided a helpful introduction to the topic. Hash functions, cryptography, and digital signatures are essential tools for maintaining privacy and trust in the digital world.


메타데이터
post_id
422a71c7cf5f
slug
introduction-to-cryptography-hash-functions-and-digital-signatures-422a71c7cf5f
url
https://medium.com/@essbante/introduction-to-cryptography-hash-functions-and-digital-signatures-422a71c7cf5f
canonical_url
https://medium.com/@essbante/introduction-to-cryptography-hash-functions-and-digital-signatures-422a71c7cf5f
author_url
https://medium.com/@essbante
status
ok
fetched_at
2026-07-22 14:22:45