# Cryptography/Symmetric Ciphers

A **symmetric key cipher** (also called a **secret-key cipher**, or a **one-key cipher**, or a **private-key cipher**, or a **shared-key cipher**) Shared_secretis one that uses the same (necessarily secret) key to encrypt messages as it does to decrypt messages.

Until the invention of asymmetric key cryptography (commonly termed "public key / private key" crypto) in the 1970s, all ciphers were symmetric. Each party to the communication needed a key to encrypt a message; and a recipient needed a copy of the same key to decrypt the message. This presented a significant problem, as it required all parties to have a secure communication system (e.g. face-to-face meeting or secure courier) in order to distribute the required keys. The number of secure transfers required rises impossibly, and wholly impractically, quickly with the number of participants.

### Formal DefinitionEdit

Any cryptosystem based on a symmetric key cipher conforms to the following definition:

- M : message to be enciphered
- K : a secret key
- E : enciphering function
- D : deciphering function
- C : enciphered message. C := E(M, K)
- For all M, C, and K, M = D(C,K) = D(E(M,K),K)

### Reciprocal CiphersEdit

Some shared-key ciphers are also "reciprocal ciphers." A reciprocal cipher applies the same transformation to decrypt a message as the one used to encrypt it. In the language of the formal definition above, E = D for a reciprocal cipher.

An example of a reciprocal cipher is Rot 13, in which the same alphabetic shift is used in both cases.

The xor-cipher (often used with one-time-pads) is another reciprocal cipher.^{[1]}

Reciprocal ciphers have the advantage that the decoding machine can be set up exactly the same as the encoding machine --
reciprocal ciphers do not require the operator to remember to switch between "decoding" and "encoding".^{[2]}

### Symmetric Cypher AdvantagesEdit

Symmetric key ciphers are typically much less computational overhead Overhead_(computing) than Asymmetric ciphers, sometimes this difference in computing overhead per character can be several orders of magnitude^{[3]}. As such they are still used for bulk encryption of files and data streams for online applications.

### UseEdit

To set up a secure communication session Session_key between two parties the following actions take place Transport_Layer_Security:

- Alice tells Bob (in cleartext) that she wants a secure connection.
- Bob generates a single use (session), public/private (asymmetric) key pair (Kpb Kpr).
- Alice generates a single use (session) symmetric key. This will be the shared secret (Ks).
- Bob sends Alice the public key (Kpb).
- Alice encrypts her shared session key Ks with the Public key Kpb Ck := E(Ks, Kpb) and sends it to Bob
- Bob decrypts the message with his private key to obtains the shared session key Ks := D(Ck, Kpr)
- Now Alice and Bob have a shares secret (symmetric key) to secure communication on this connection for this session
- Either party can encrypt a message simply by C := E(M, Ks) and decrypt is by M = D(C,K) = D(E(M,Ks),Ks)

This is the Basis for Diffie–Hellman Diffie_Hellman_key_exchange key exchange Key exchange and its more advanced successors Transport_Layer_Security.

## ExamplesEdit

- DES
^{[4]} - DES3
^{[5]} - AES
^{[6]} - TwoFish
^{[7]} - BlowFish
- Idea
- Chameleon

## Further ReadingEdit

*This page or section of the Cryptography book is a stub. You can help Wikibooks by expanding it.*

- ↑ Wikipedia: Symmetric-key algorithm#Reciprocal cipher
- ↑ Greg Goebel. "The Mechanization of Ciphers". 2018.
- ↑ http://s3.amazonaws.com/academia.edu.documents/33551175/IJETAE_1211_02.pdf?AWSAccessKeyId=AKIAIWOWYYGZ2Y53UL3A&Expires=1499689317&Signature=EavACFmNNlzcPXDa5kVZS9rh7Yw%3D&response-content-disposition=inline%3B%20filename%3DDES_AES_and_Blowfish_Symmetric_Key_Crypt.pdf
- ↑ https://www.schneier.com/blog/archives/2004/10/the_legacy_of_d.html
- ↑ https://www.schneier.com/academic/blowfish/
- ↑ https://books.google.com/books?hl=en&lr=&id=fNaoCAAAQBAJ&oi=fnd&pg=PA1&dq=speed+advantages+in+symmetric+ciphers+aes&ots=7hPPzLQjm5&sig=kaBEJW49jdonFWKin0-p6ZhROCA#v=onepage&q=speed%20advantages%20in%20symmetric%20ciphers%20aes&f=false
- ↑ http://s3.amazonaws.com/academia.edu.documents/33551175/IJETAE_1211_02.pdf?AWSAccessKeyId=AKIAIWOWYYGZ2Y53UL3A&Expires=1499689317&Signature=EavACFmNNlzcPXDa5kVZS9rh7Yw%3D&response-content-disposition=inline%3B%20filename%3DDES_AES_and_Blowfish_Symmetric_Key_Crypt.pdf