The Substitution Technique

(Ema_0, Unmasking/Decryption) – The replacement technique does exactly the opposite of the substitution technique. The substitution algorithm reads the contents of the key sequentially, performs XOR (^) with the contents of the block and overwrites it. This restores the values of the original data source.

If both techniques were performed in the masking stage and the replacing technique was performed first, the substitution must be performed last in the unmasking stage.

Below is the substitution technique (unmasking) applied to the previous replacement (masking) example.

KEY & DATA
INDEX
KEY
VALUES
DATA BEFORE
SUBSTITUTION
SUBSTITUTION
(MASKING)
DATA
RESULT
000033@aa
001048Rbb
002043Hcc
003045Idd
004044Iee
005037Cff
006046Igg
007040@hh
008041@ii
009042@jj
010036Okk
011034Nll
012038Kmm
013039Inn
014035Loo
015047_pp
000001002003004005006007008009010011012013014015

Example of substitution at the unmasking/decryption stage

ASCII decimal unsigned values:
@=64, R=82, H=72, I=73, I=73, C=67, I=73, @=64, @=64, @=64, O=79, N=78, K=75, I=73, L=76, _=95

The four first replacement:
1. @=64; key(0)=33; 64^33=97, a → data(0)
2. R=82; key(1)=48; 82^48=98, b → data(1)
3. H=72; key(2)=43; 72^43=99, c → data(2)
4. I=73; key(3)=45; 73^45=100, d → data(3)
and so on.

With the substitution technique we get the source string [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p] as output.

Scroll to Top