1.9 KiB
Block Ciphers
The main concept here is twofold:
- we take blocks of data and cipher the blocks
- A given key is actually used to generate recursive keys to be further used on the data itself
bs example ahead
Say we have a key 7 and some data 123456. We take the whole data set and chunk it into blocks(for example): 12 34 56.
Let's say our function here is to just add 7 to each block so we do the first step:
12 + 7 = 19
Unlike other ciphers we don't reuse 7; instead we use the new thing as both the new key and part of our cipher text
19 + 34 = 53
Cipher: 1953..
53 + 56 = 109 <= let's pretend that this rolls over 99 and back to 00
09 <= like this
Final cipher: 195309
It should be noted that in practice these functions usually take in huge keys and blocks.
Deciphering
Start from the back of the cipher not the front; if we used and xor function scheme (which is a symmetrical function) we would simply just xor the last block by itself and thus perform the same encryption scheme but in reverse.
Example::Encryption
Key: 110
Function scheme: xor
Data: 101 001 111
101 011 010
110 001 111
011 010 101 <= encrypted
Example::Decryption
Ciphered: 011 010 101
Function scheme: xor
...
Feistal Cipher
Two main components:
-
each thing in the data to cipher is replaced by a ciphered thing
-
nothing is added or deleted or replaced in sequence, instead the order of things is changed.
Basically imagine that every type of thing in our data maps to some other type of thing/thing in the data and thus become swapped/reordered.
DES - Data Encryption Standard
Widely used until about 2001 when AES surpassed it as the newer(ish(kinda)) standard.
DEA was the actual algorithm tho:
- 64 bit blocks
- 56 bit keys
- turns a 64-bit input into a 64-bit output (wew)
- Steps in reverse also reverse the encryption itself