### Cryptography Basics/Terminologies

Concept of:

- Cryptography Ciphers:

–> Difference between asymmetric and symmetric ciphers.

–> Hashing and MACs

–> Concept of certificates, digital signatures, and signing

2) Keys in cryptography

–> Key storage, Key generation, key derivation, key import, key export, key configuration, key slots shared secret key, master key and etc

3) Attacks in cryptography

–>

4) Miscellaneous things:

–> Random number generator,

## Cryptography Ciphers

**One-way compression functions**

One-way compression functions: In cryptography, **a one-way compression function is a function that transforms two fixed-length inputs into a fixed-length output.**

**One-way compression functions** are built from block ciphers. Some methods to turn any normal block cipher into a one-way compression function are **Davies–Meyer**, **Matyas–Meyer–Oseas**, **Miyaguchi–Preneel** (single-block-length compression functions) and **MDC-2/Meyer–Schilling**, **MDC-4**, **Hirose** (double-block-length compression functions). These methods are described in detail further down.

**Miyaguchi-Preneel Compression function: is used inside SHE standard cryptography**

A common use of **one-way compression functions** is inside cryptographic hash functions. Most widely used hash functions, including MD5, SHA-1 (which is deprecated^{[2]}) and SHA-2 use this construction.

*Using a block cipher to build the one-way compression function for a hash function is usually somewhat slower than using a specially designed one-way compression function in the hash function. This is because all known secure constructions do the key scheduling for each block of the message. Black, Cochran and Shrimpton have shown that it is impossible to construct a one-way compression function that makes only one call to a block cipher with a fixed key. ^{[6]} In practice reasonable speeds are achieved provided the key scheduling of the selected block cipher is not a too heavy operation.*

But, in some cases it is easier because a single implementation of a block cipher can be used for both a block cipher and a hash function. It can also save code space in very tiny embedded systems like for instance smart cards or nodes in cars or other machines

A compression function mixes two fixed length inputs and produces a single fixed length output of the same size as one of the inputs. This can also be seen as that the compression function transforms one large fixed-length input into a shorter, fixed-length output.

**2) Block Cipher**: Block ciphers take (like one-way compression functions) **two fixed size inputs** (the key and the plaintext) and **return one single output** (the ciphertext) which is the same size as the input plaintext. modern block ciphers are only partially one-way. That is, **given a plaintext and a ciphertext it is infeasible to find a key that encrypts the plaintext to the ciphertext.** But, **given a ciphertext and a key a matching plaintext can be found simply by using the block cipher’s** decryption function.

Thus, to turn a block cipher into a one-way compression function some extra operations have to be added.

Some methods **to turn any normal block cipher into a one-way compression function** are Davies–Meyer, Matyas–Meyer–Oseas, **Miyaguchi–Preneel (single-block-length compression functions)** and MDC-2, MDC-4, Hirose (double-block-length compressions functions.

- Stream Cipher:

AES:

- ECB mode:
- CBC mode:

MAC generation/verification:

Compression Function

# Cryptographic Keys

Types of keys in cryptography:

What Is Secret Key Cryptography? A Complete Guide – Helenix

- Secret Key: the key which is used in symmetric ciphers is a called as secret key. As this is single key which can be used for both encryption/decryptions, thus it is called as secret key.
- Private key: private key is used in asymmetric key cryptography, where there are 2 different keys for encryption and decryption.

Key Usage flags: Different keys are used for different features and specs. So, there are concept of flags through which we can specify which key is to be used for what purpose and its usage limitation. Broadly there are x number of fields in Key usage:

Key derivation: A **Key derivation function (KDF)** is a basic and essential component of cryptographic systems: Its **goal is to take a source of initial keying material, usually containing some good amount of randomness, but not distributed uniformly or for which an attacker has some partial knowledge and derive from it one or more cryptographically strong secret keys.**

There are many forms of KDF’s, and not all functions used as KDF are explicitly named as KDF’s. For instance, the KDF of TLS is simply called “the PRF” for Pseudo-Random-Functions, which is a much more generic term

Some KDF’s have input limitations, some have output limitations and not all KDF’s have the same configuration parameters.

The base construction of a KDF is:

input:

- a binary encoded secret or key
- other information to derive a specific key (optional)
- output size (if configurable)

output:

- a derived key or derived keying material.

Furthermore, there are many different parameters possible:

- a salt
- work factor (for PBKDF’s)
- memory usage (for PBKDF’s)
- parallelism (for PBKDF’s)

# Cryptography Miscellenous terms

Pseudorandom Function Family(PRF):

##### Author: Kunal Gupta

Author