Rivest Cipher 5
(RC 5)
Encryption
Algorithm
BY ALFIAN NUR FATHONI L200190002
RC5 encryption
algorithm is a fast
symmetric block cipher
suitable for hardware or
software imple-
mentations.
-- ron rivest --
RC5 is symetric block chiper (fixed bit-legth).
Suitable for hardware or software because
only using computational primitiva operations.
Variable-length (costumized parameterization)
cryptographic key, so the user can choose the
level of securoty appropiate for spesific
application.
What is block chiper ?
Block cipher is a deterministic algorithm operating on fixed-length groups
of bits, called blocks.
Block ciphers are widely used to encrypt large amounts of data by chunking
chipers.
What is block chiper ?
How about RC5 ?
RC5-w/r/b ==> RC5-32/12/7
(w) word size in bits, each word contains u = (w/8).
(r) : number of encryption rounds
(b) : number of bytes in secret key
How about RC5 ?
RC5-w/r/b ==> RC5-32/12/7
(w) word size in bits, each word contains u = (w/8).
(r) : number of encryption rounds
(b) : number of bytes in secret key
Magic Constant
RC5 Diagram
Notation
word addition (+) is mod by (2 ** w) and inverse for (-)
(^) is XOR
(x <<< y) is cyclic rotation word x left by bits y and
vice versa
INITIALIZATION
KEY = "CryptoClassUMS2022"
w = 32 bits
r = 12 round
b = 18 bytes
plaintext = "Happy New Year Eve 2023"
KEY EXPANSION STEP 1
Magic Constant for 32 bit :
p = 0xb7e15163
q = 0x9e3779b9
(total bytes of word block) u = w/8
u = 32/8
(L table length) c = b/u
c = 18/4 round up
c=5
KEY EXPANSION STEP 2
Converting secret key from bytes to words
L =[0, 0, 0, 0, 0]
What Is <<< actually do ?
KEY EXPANSION STEP 3
Initializing Array of S (t = (2 * (r + 1)) )
combining magic constant and aritmetic progression module (2**w)
S =[0, . . ., 0]
KEY EXPANSION STEP 4
Mix in the user's secret key in three passes over the arrays S and L.
XOR
KEY EXPANSION RESULT
S Table (array)
ENCRYPTION
DECRYPTION
DEMO & CODE
HTTPS://GITHUB.COM/ALFIANKAN/RC5-GOLANG-IMPLEMENTATION
Thank You for
listening!