# Cryptography - Algorithm (called a Cipher)

A cipher is an algorithm that encrypt a plain text message into a ciphertext.

Cipher algorithm can be categorized by the key that they used as parameters.

## List

Cipher Symmetry Key Encryption /
Decryption
Data
Integrity
Authenticity Secrecy
Advanced Encryption Standard (AES) symmetric Shared Key Two-way Yes Yes Yes
RSA (Rivest–Shamir–Adleman) asymmetric Key Pair Two-way Yes Yes Yes
Hash algorithms (Md5, sha1-N) Na No key One-way Yes No No
Base64 (bit to characters) Na No key Two-way No No No
Mac Na Shared key Na Yes Yes No

## Properties

### Commutative

A commutative cipher is one in which the order of encryption and decryption is interchangeable, just as the order of multiplication is interchangeable (i.e., A*B*C = A*C*B = C*B*A).

### Symmetry

Often a cryptosystem will use both type of algorithms. For example, a symmetric key to exchange keys and an asymmetric cipher to encrypt the messages.

#### Symmetric

Encryption algorithms which use the same and single key for both encryption and decryption are known as:

• symmetric key algorithms.
• or secret-key encryption

#### Asymmetric

Asymmetric key algorithms (also known as public key cryptographic algorithms) was invented in the 1970s.

They used two keys (one public and one private. It is asymmetric because you need the other key pair to decrypt.

##### Public Key
###### Public key Postal Analogy
• Bob and Alice have separate padlocks.
• Alice asks Bob to send his open padlock to her through regular mail, keeping his key to himself.
• Bob send it to her
• She uses it to lock a box containing her message
• She sends the locked box to Bob.
• Bob can then unlock the box with his key
• Bob can read the message from Alice.
• To reply, Bob must similarly get Alice's open padlock to lock the box before sending it back to her.

The critical advantage in an asymmetric key system is that Bob and Alice never need to:

• send a copy of their keys to each other.
• trust the postal service.

In addition, if Bob were careless and allowed someone else to copy his key, Alice's messages to Bob would be compromised, but Alice's messages to other people would remain secret, since the other people would be providing different padlocks for Alice to use.

###### Public key Concept

When a message is encrypted with:

• the private key, only his public key will successfully decrypt it, authenticating the authorship of the message (ie the owner of the private key)
• the public key, only the private key can decrypt it.

In this scheme, secret messages can be exchanged with no prior secret agreement, each person using:

• the other's public key to encrypt,
• his own private key to decrypt.

In a secure asymmetric key encryption scheme, the private key should not be deducible from the public key. The design is such that finding out the private key is extremely difficult, even if the corresponding public key is known.

Because of the computational complexity of asymmetric encryption, it is usually used to exchange an on-the-fly symmetric_key (e.g. a session key), which will only be used for the current session. This symmetric key is then used to encrypt the rest of the potentially long message sequence. The symmetric encryption/decryption is based on simpler algorithms and is much faster.

##### Three-pass protocol

The Three-pass protocol 1) requires neither party to even touch the other party's padlock (or key to get access);

Bob and Alice have separate padlocks.

• Alice puts the secret message in a box,
• Alice locks the box using a padlock to which only she has a key.
• Alice sends the box to Bob through regular mail.
• Bob sends it back to Alice.
• Alice sends it back to Bob.
• Bob unlock the box with his key
• Bob read the message from Alice.

This scheme is only possible with commutative cipher.

## SSL

During the SSL negotiation between client and server, the server and client will indicate to each other a list of algorithms that can be understood ranked by order of preference. The common preferred algorithm is then chosen.

## Specification

To know more about cipher, you can refer to this specifications:

Discover More
Ansible - Vault

A vault is the encrypted format of data through the combination of a label and a password known as vault id Encrypted data may be: a whole file or a property value This is available since Ansible...
Base 36 (0-9 and A-Z)

Crypto

graphy is the science of cryptographic algorithms (known as Cipher) that implements the following functionalities: Data Integrity - the message (data) was not altered during transit Authenticity -...
Cryptographic - Private Key

This article talks the secret known as the private key in a asymmetric cryptographic scheme. A private key is a cryptographic key that is private (that you should keep secret). This page is how to...
Cryptography - (Ciphertext|cyphertext|Message Digest|Digest)

In cryptography, ciphertext or cyphertext is the result of encryption performed on plaintext using an algorithm, called a cipher. In the context of hashing / data integrity, the cyphertext is known...
Cryptography - Block Cipher

A Block cipher is a cipher where the unit of process is a block. A family of functions and their inverse functions that is parameterized by cryptographic keys. The functions map bit strings of a fixed...
Cryptography - Decryption (Deciphering)

A process from a cipher that transforms encrypted data into the original usable data
Cryptography - Encryption (Enciphering)

Encryption is the function of a cipher that transforms usable data into an unreadable form. It provides confidentiality if a secret is used in the encryption. There is two class of encryption. ...
Cryptography - Hash

A hash function is an encryption crypto algorithm that takes as data as input (possibly large and of variable-sized) and produces a short fixed-length integer value (generally printed as an hexadecimal...
Cryptography - Input Data (plain text | clear text | message)

Plain text is a text that you want to send. Plain text is also known as Cleartext Usable text Message Even if its name contains text, the input can be any piece of data: file content, network...