Demystifying the Code: An Introduction to Cryptography

The Hackers Meetup
5 min readApr 24, 2024

Cryptography

Cryptography is a broad field spanning data and communication-securing techniques. Formally, it can be defined as Cryptography is the practice and study of techniques for securing communication and data in the presence of adversaries.

Basic Terminologies:

  • A plaintext message is called plaintext (sometimes simply the plaintext). The value of plaintext is simply the content of the message. A plaintext message cannot be transmitted as is because adversaries are expected to want to learn all they can, so we have to keep it hidden from them. The process of disguising a message in such a way as to hide its substance is called encryption. An encrypted message is called ciphertext. The process of turning ciphertext back into plaintext is decryption.
  • A cipher (or cipher) is an algorithm for performing encryption or decryption — a series of well-defined steps that can be followed as a procedure. In coding, the ciphertext is also referred to as the decoded message.
  • Cryptosystem is a term used for cryptographic techniques and a set of infrastructure supporting the techniques, which together provide secure communication. Thus, a cryptosystem is also sometimes called a cipher system. A basic cryptosystem is mainly comprised of the following:
  1. Plaintext
  2. Encryption Algorithm
  3. Ciphertext
  4. Decryption Algorithm
  5. Encryption Key
  6. Decryption Key
  • While cryptography is the science of securing data, cryptanalysis is the science of analyzing and breaking secure communication Classical cryptanalysis involves a combination of analytical reasoning, mathematical tools, pattern finding, patience, determination, and luck. Cryptanalysts are also called attackers.
  • Cryptology embraces both cryptography and cryptanalysis.

History of cryptography

· Hieroglyph

The earliest known evidence of cryptography comes from the use of ‘hieroglyph’ and the earliest reported use is from around 2000 to 4000 years ago when Egyptians used it for communicating messages from one tomb to another using messages written in hieroglyphs.

· Caesar Shift Cipher

We shall now see a Caesar Shift Cipher. It consists of the letters of the message being shifted along some agreed number of places down the alphabet. The sender would then send to the recipient the message written in code.

The recipient of this message would then shift the letters back by the same number and thereby obtain the original message. In the Caesar cipher, the shift is three, it is named after Julius Caesar, who used it with a shift of three to protect messages of military significance.

PLAINTEXT: internet society chapter

CYPHERTEXT: lqwhuqhw vrflhwb fkdswhu

Goal and Services

Goal: The primary objective of cryptography is to protect sensitive information while it is stored on the hard disk or transmitted through an unsecured medium. Usually, that medium is a computer network.

Services: Cryptography can provide the following services:

· Confidentiality (secrecy): Ensuring that only the receiver can understand the message and not anyone else. Information cannot be read by anyone else other than the intended receiver.

· Integrity (anti-tampering): Providing confidence to the receiver that no one has tampered with the content or that the message has not been changed or altered from the original.

· Authentication: Cryptography can provide the required elements for identity verification for authenticating users.

· Non-repudiation: A mechanism is needed to verify the identity of the sender and prove that they are the ones who sent this message.

· Types of Cryptography

  1. Symmetric Key Cryptography
  2. Asymmetric Key Cryptography
  3. Hash Functions

I. Symmetric Key Cryptography

  • Likewise referred to as Secret Key Cryptography or Standard Cryptography, Symmetric Secret. Cryptography is a file encryption system in which the sender as well as receiver of a message share a same secret that is made use of to securely together with decrypt the message.

· Symmetric Key Cryptography — Types

1. Data Encryption Standard (DES)

2. Triple DES

3. Advanced Encryption Standard (AES)

II. Asymmetric Key Cryptography

Asymmetric cryptography, also known as Public-key cryptography, refers to a cryptographic algorithm that requires two separate keys, one of which is private and one of which is public. The public key is used to encrypt the message and the private one is used to decrypt the message. Public Key Cryptography is a very advanced form of cryptography.

Officially, it was invented by Whitfield Diffie and Martin Hellman in 1975. The basic technique of public key cryptography was first discovered in 1973 by the British Clifford Cocks of Communications-Electronics Security Group (CESG) of (Government Communications Headquarters — GCHQ) but this was a secret until 1997.

· Asymmetric Key Cryptography — Types

1. Digital Signature Standard (DSS)

2. Algorithm — RSA

3. RSA Cryptanalysis

III. Hash Functions

A hash function is a method that takes a block of information and produces a fixed-length string, known as the hash value. Any modification, to the information is likely to change the hash value. The original data is referred to as the message while the resulting hash value is sometimes called the digest or simply digest.

A reliable cryptographic hash function should have three characteristics:

  1. It should be simple to compute the hash value for any given message.
  2. It should be practically impossible to create a message, with a hash value.
  3. It should be practically impossible to alter a message without changing its hash value.

· SHA Hash function

SHA: The Secure Hash Algorithm (SHA) hash functions are a set of cryptographic hash functions designed by the National Security Agency (NSA) and published by the NIST as a U.S. Federal Information Processing standard. Because of the successful attacks on MD5, SHA-0, and theoretical attacks on SHA-1, NIST perceived a need for an alternative, dissimilar cryptographic hash, which became SHA-3. In October 2012, the National Institute of Standards and Technology (NIST) chose the Keccak algorithm as the new SHA-3 standard.

-By Hriday Dave

--

--

The Hackers Meetup

Initiative of @viralparmarhack to provide a proper platform for cyber security researchers & like-minded people to establish a community.