# What is Cryptography (All Types of with Examples)

Cryptography is the art and science of concealing the messages to introduce secrecy in information. Mathematical techniques are used to encrypt and decrypt data.

Cryptography definition and meaning.

Cryptography is derived from the Greek words: kryptós, which means “hidden”, and gráphein, meaning “to write” or “hidden writing”.

Basically, cryptography is the art and science of keeping messages secure.

A brief history of cryptography:

As you know the evolution of human beings and civilization have always led to the grouping of people (tribes and kingdoms). All this has continually led to battles, supremacy, politics and struggle for power.

These problems have created the need for people to communicate secretly, thus the evolution of cryptography.

Cryptography can be traced in early Roman and Egyptian civilizations. For example, Hieroglyphic was used by Egyptians like 4000 years ago for communication and sending messages written in hieroglyph.

Also, Julius Caesar used a shift of 3 on the alphabet for the encryption of messages for military purposes. His technique of encryption is called Caesar Cipher.

Lastly, a known substitution technique called Kamasutra cipher was used around 400 BC, to teach women how to hide secret messages from prying eyes.

Here are 6 basic objectives of cryptography:

• Confidentiality of message (privacy), meaning that only the authorized recipient should have access to the message.
• The integrity of the message, meaning that the recipient should be able to determine whether the message has been altered.
• Authentication of the sender, meaning that the recipient should be able to verify from the message (the origin and the sender of the message).
• Non-repudiation of the sender, meaning that the sender should not be able to deny sending the message.
• Access control of the message, to identify the valid recipients of the message.
• Availability of the message determines the validity limit of the message based on, channel and time.

Here are definitions of basic principles and terms:

• A cipher is an algorithm used for performing both the encryption and decryption.
• Plaintext refers to the message in its original form before encryption has been done.
• Ciphertext refers to the unreadable scrambled message after the encryption process.
• A key is a secret string of characters, more like a password that is used during both encryption and decryption.
• Encryption refers to the process of encoding data and information to secure it.
• Decryption is the reverse of the encryption and often involves the uses of the same key used during the encryption.
• Cryptanalysis is the art of breaking ciphers and codes without the initial knowledge of the key.
• Steganography is a subfield of cryptography, that deals with hiding the existence of a message but not the content of the message itself (often with microdots and invisible inks).
• A cryptosystem is the use of cryptographic techniques and development of a good infrastructure for secure information systems.

### Types of Cryptography

Each of this cryptographic type is used for a specific situation.

• Secret Key Cryptography (SKC) – uses a single key for both encryption and decryption. It is also called symmetric encryption. It is mostly used for privacy and confidentiality.
• Public Key Cryptography (PKC) – uses one key for encryption and another for decryption. It is also called asymmetric encryption. It is mostly used for authentication, non-repudiation, and key exchange.
• Hash Functions – uses a mathematical transformation to irreversibly encrypt information, providing a digital fingerprint. It is mostly used for message integrity.

#### Symmetric Key Cryptography

Symmetric Key Cryptography is an encryption system in which the sender and the receiver of the message share a single, common key that is used to encrypt and decrypt the message.

It goes with other names like (Secret Key Cryptography, Conventional Cryptography, Secret Key algorithm and symmetric algorithm).

A key, in this case, is a piece of information (a parameter) that determines the functional output of a cryptographic algorithm or cipher.

The key for encrypting and decrypting the file have to be known to all the recipients. Else, the message can not be decrypted by conventional means.

Here are examples of Symmetric Key Cryptography:

• ##### Data encryption standard (DES)

The Data Encryption Standard was published in 1977 by the US National Bureau of Standards. DES uses a 56-bit key and maps a 64-bit input block of plaintext onto a 64-bit output block of ciphertext. 56 bits is a small key compared to today’s computers that have the better processing power.

• ##### Triple DES

Triple DES was the answer to many of the shortcomings of DES. Since it is based on the DES algorithm, it’s very easy to modify existing software to use Triple DES.

It also has the advantage of the proven reliability and a longer key length that eliminates many of the shortcut attacks that can be used to reduce the amount of time it takes to break DES.

• ##### Advanced Encryption Standard (AES)

Advanced Encryption Standard (AES) is an encryption standard adopted by the US government. The standard comprises three block ciphers, AES-128, AES-192, and AES-256, adopted from a large r collection originally published as Rijndael.

Each AES cipher has a 128-bit block size, with key sizes of 128, 192 and 256 bits, respectively. The AES ciphers have been analyzed extensively and are now used worldwide, as was the case with its predecessor, the Data Encryption Standard (DES).

• ##### International Data Encryption Algorithm (IDEA)

The International Data Encryption Algorithm was developed in 1991. It uses a 128-bit key to encrypt a 64-bit block of plaintext into a 64-bit block of ciphertext.

IDEA’s general structure is very similar to DES, it performs 17 rounds, each round taking 64 bits of input to produce a 64-bit output, using per-round keys generated from the 128-bit key.

Other examples of symmetric key cryptography include Lucifer, Madryga, FEAL, REDOC, LOKI, GOST, CAST, Blowfish, Safer, Crab, RC5 and many others.

#### Asymmetric Key Cryptography

Asymmetric cryptography, also known as public-key cryptography, refers to a cryptographic algorithm which requires two separate keys, one of which is private and one 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. 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 Group (CESG) of (Government Communications Headquarters – GCHQ) but kept secret until 1997.

Here are examples of Asymmetric Key Cryptography:

• ##### Digital Signature Standard (DSS)

Digital Signature Standard (DSS) is the digital signature algorithm (DSA) developed by the US National Security Agency (NSA) to generate a digital signature for the authentication of electronic documents.

DSS was put forth by the National Institute of Standards and Technology (NIST) in 1994 and has become the United States government standard for authentication of electronic documents. DSS is specified in Federal Information Processing Standard (FIPS) 186.

• ##### RSA algorithm

RSA (Rivest, Shamir, and Adleman who first publicly described it in 1977) is an algorithm for public-key cryptography.

It is the first algorithm known to be suitable for signing as well as encryption, and one of the first great advances in public key cryptography.

RSA is widely used in electronic commerce protocols and is believed to be secure given sufficiently long keys and the use of up-to-date implementations.

• ##### ElGamal

ElGamal is a public key method that is used in both encryption and digital signing. The encryption algorithm is similar in nature to the Diffie-Hellman Key agreement protocol.

It is used in many applications and uses discrete logarithms. ElGamal encryption is used in the free GNU Privacy Guard software.

#### Hash Functions

A cryptographic hash function is a hash function that takes an arbitrary block of data and returns a fixed-size bit string, the cryptographic hash value, such that any change to the data will change the hash value.

The data to be encoded are often called the message, and the hash value is sometimes called the message digest or simply digest.

Here are the four main properties of an ideal cryptographic hash function:

• It is easy to compute the hash value for any given message.
• It is infeasible to generate a message that has a given hash.
• It is infeasible to modify a message without changing the hash.
• It is infeasible to find two different messages with the same hash.

Here is an example of a 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 US Federal Information Processing Standard.

SHA stands for Secure Hash Algorithm.

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.

### Cryptography algorithms

Here are 5 most common encryption algorithms.

• Triple DES – uses three keys each with 56 bits. It is mostly used in hardware encryption devices.
• Blowfish – it splits messages into blocks of 64 bits and then encrypts them each at a time. It is mostly used in password management software.
• Twofish – it is the symmetric technique that requires only a single key. It is ideal for both hardware and software.
• Advanced Encryption Standard (AES) – uses 128, 192, and 256 bits long keys for the encryption.
• RSA – is used as the standard for data encryption over the internet. It uses a pair of keys for encryption and decryption of data.

### Cryptography examples

Here are  4 examples of cryptography used today.

• Secure Socket Layer (SSL) and Transport Layer Standard (TSL) – are used for transmitting data over the Internet.
• RSA – used in electronic protocols, software signing, key exchange, and digital signatures.
• Pretty Good Privacy (PGP) – used for the authentication of data communication and encryption/decryption of email messages.
• GNU Privacy Guard (GnuPG/GPG) – is a standard that tracks specifications of OpenPGP.

Now I want to hear from you.

What do you think of cryptography?

Or maybe I missed an important aspect of encryption.

Either way, let me know by leaving a comment below.