Blockchain

Cryotography

What is Cryptography?

Cryptography is the science of securing information through mathematical techniques that transform data into a format that is unreadable to unauthorized parties. It is fundamental to modern digital security, ensuring that sensitive data remains private, authentic, and unaltered during transmission and storage. Cryptography is essential in protecting the integrity, confidentiality, and authenticity of information.

Types of Cryptography

There are three main types of cryptography:

  1. Symmetric-Key Cryptography
    • In symmetric-key cryptography, the same key is used for both encryption and decryption.
    • The key must be kept secret and shared between the sender and the receiver.
    • Example:
      • AES (Advanced Encryption Standard) : A widely used encryption method that uses a single key for both encryption and decryption. It’s fast and efficient for encrypting large volumes of data.
    • Scenario:
      • Two parties, Alice and Bob, want to communicate securely. Alice encrypts a message with a shared secret key, sends it to Bob, and Bob decrypts it using the same key.
  2. Asymmetric-Key Cryptography (Public-Key Cryptography)
    • Asymmetric cryptography uses two different keys: a public key and a private key.
    • The public key is shared openly, while the private key is kept secret.
    • The public key is used to encrypt the data, and only the corresponding private key can decrypt it.
    • Example:
      • RSA (Rivest–Shamir–Adleman) : A widely used public-key cryptosystem where encryption is done using the recipient's public key, and decryption is done with their private key.
    • Scenario:
      • Alice wants to send Bob a secure message. She encrypts the message using Bob’s public key, and only Bob can decrypt it using his private key.
  3. Hash Functions
    • Hash functions are a one-way cryptographic operation that take an input (or message) and return a fixed-size string of bytes, typically a hash.
    • Unlike encryption, hash functions are irreversible. They are commonly used to verify data integrity and authenticate messages.
    • Example:
      • SHA-256 (Secure Hash Algorithm 256-bit) : A popular cryptographic hash function used to produce a unique, fixed-size output (hash) for any given input.
    • Scenario:
      • When a file is downloaded, its hash is compared to the original file's hash to ensure no changes occurred during transmission (integrity verification).

How is Cryptography used in Blockchain?

Cryptography is a cornerstone of blockchain technology, enabling its core features of security, transparency, and immutability. Here’s how cryptography is applied in blockchain: