0% found this document useful (0 votes)
53 views

Message Authentication Code

The document discusses Message Authentication Codes (MAC) and how they can be used to ensure message integrity and authenticate the identity of the message sender. Specifically, it covers how hash functions work by condensing messages into fixed-length digests in a one-way process. It then discusses how MACs combine hash functions with encryption to provide integrity, identity validation, and non-repudiation for messages. The goal of MACs is to protect message integrity and validate the originator's identity through techniques like hash functions, message encryption, and generating message authentication codes.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Message Authentication Code

The document discusses Message Authentication Codes (MAC) and how they can be used to ensure message integrity and authenticate the identity of the message sender. Specifically, it covers how hash functions work by condensing messages into fixed-length digests in a one-way process. It then discusses how MACs combine hash functions with encryption to provide integrity, identity validation, and non-repudiation for messages. The goal of MACs is to protect message integrity and validate the originator's identity through techniques like hash functions, message encryption, and generating message authentication codes.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Teknik Informatika

Universitas Surabaya

CRYPTOGRAPHY
Message Authentication Code – Part 1
OVERVIEW

• Previously, we study about encryption “how to encryption can be used


to prevent eavesdropper.

• But, not all security concerns are related to the ability or inability of an
adversary to learn something about messages being sent.
CASE

Consider the case that a large supermarket chain sends an email request
to purchase 10,000 crates of soda from a supplier. Upon receiving such a
request, the supplier has to ask itself two questions.

1. Is the order authentic? That is, did the supermarket chain really issue
the order, or was it issued by an adversary who spoofed the email
address of the supermarket (something that is remarkably easy to do).
2. If the order was issued by the supermarket, then the supplier must still
ask whether the details of the order that it received are exactly those
sent by the supermarket, or were these details somehow changed en
route by an adversarial router
GOAL of MA

• Protecting the integrity of a message


• Validating identity of originator
• Non-repudiation of origin (dispute resolution)

Solution :
• Hash Function
• Message Encryption
• Message Authentication Code (MAC)
01
Hash Function
Hash Function
• Condenses arbitrary message (m) to
string (h) fixed size.

• Message digest

• Irreversible

• One way – hash function is not


encryption process.
h = hash value = message digest = digest
• No key
size(m) = 1MB -> size(h) = 256 bit !!
Example
Purpose

• Purpose of the HASH function is to produce a ”fingerprint.


• Properties of a HASH function H :
-H can be applied to a block of data at any size
-H produces a fixed length output
-H(x) is easy to compute for any given x.
-For any given block x, it is computationally infeasible to find x such
that H(x) = h
-For any given block x, it is computationally infeasible to find
with H(y) = H(x).
-It is computationally infeasible to find any pair (x, y) such that H(x)
= H(y)
Applications

• Cryptographic Checksum
• Message Integrity Check (MIC)
• Manipulation Detection Code (MDC)
01
MD5
MD5
• Developed by Professor Ronald L. Rivest in 1991.

• MD5 message-digest algorithm takes as input a message of arbitrary


length and produces as output a 128-bit "fingerprint" or "message
digest" of the input.

• The MD5 algorithm is intended for digital signature applications, where


a large file must be "compressed" in a secure manner before being
encrypted with a private (secret) key under a public-key cryptosystem
such as RSA.”
Chained Block Cipher

 Enkripsi blok pertama memerlukan blok semu (C0) yang disebut IV


(initialization vector).
 IV dapat diberikan oleh pengguna (user-defined) atau dibangkitkan
secara acak oleh program (random).
 Pada dekripsi, blok plainteks diperoleh dengan cara meng-XOR-kan
IV dengan hasil dekripsi terhadap blok cipherteks pertama.
Chained Block Cipher
Plainteks : 10100010001110101001

Plainteks dibagi menjadi blok-blok yang berukuran 4 bit:

1010 0010 0011 1010 1001


 
atau dalam notasi HEX adalah A23A9.

 
Kunci (K) yang digunakan adalah (panjangnya juga 4 bit) : 1011 atau dalam notasi HEX adalah B.
Initialization Vector (IV) yang digunakan seluruhnya bit 0 (C0 = 0000)
Chained Block Cipher

Misalkan fungsi enkripsi E yang sederhana (tetapi lemah) adalah dengan


meng-XOR-kan blok plainteks Pi dengan K, kemudian geser secara
wrapping bit-bit dari Pi  K satu posisi ke kiri.
CBC
Chained Block Cipher

Demikian seterusnya, sehingga plainteks dan cipherteks


hasilnya adalah:

Pesan (plainteks): A23A9


Cipherteks (mode ECB): 23124
Cipherteks (mode CBC): 27FBF
TRIVIAL

Kalkulasilkan hasil enkripsi dari “MIF” menggunakan CBC

Hint :

• BINER : 01001101 01001001 01000110


• MIF (HEX) :4d 49 46
Diagram MD5
Langkah-langkah

Langkah-langkah pembuatan message digest

1. Penambahan bit-bit pengganjal (padding bits).


2. Penambahan nilai panjang pesan semula.
3. Inisialisasi penyangga (buffer) MD.
4. Pengolahan pesan dalam blok berukuran 512 bit.
Langkah-langkah

1. Penambahan bit pengganjal

• Pesan ditambah dengan sejumlah bit pengganjal sedemikian sehingga panjang pesan
(dalam satuan bit) kongruen dengan 448 modulo 512.  
• Jika panjang pesan 448 bit, maka pesan tersebut ditambah dengan 512 bit menjadi
960 bit. Jadi, panjang bit-bit pengganjal adalah antara 1 sampai 512.
• Bit-bit pengganjal terdiri dari sebuah bit 1 diikuti dengan sisanya bit 0.
Langkah-langkah

2. Penambahan Nilai Panjang Pesan

• Pesan yang telah diberi bit-bit pengganjal selanjutnya ditambah lagi dengan 64 bit
yang menyatakan panjang pesan semula.

•  Jika panjang pesan > 264 maka yang diambil adalah panjangnya dalam modulo 2 64.
Dengan kata lain, jika panjang pesan semula adalah K bit, maka 64 bit yang
ditambahkan menyatakan K modulo 264.
•  Setelah ditambah dengan 64 bit, panjang pesan sekarang menjadi kelipatan 512 bit.
Langkah-langkah

3. Inisialisasi penyangga / buffer


• MD5 membutuhkan 4 buah penyangga (buffer) yang masing-masing panjangnya 32 bit. Total
panjang penyangga adalah 4  32 = 128 bit. Keempat penyangga ini menampung hasil antara
dan hasil akhir.
•  Keempat penyangga ini diberi nama A, B, C, dan D. Empat penyangga itu disebut sebagai MD.
Setiap penyangga diinisialisasi dengan nilai-nilai (dalam notasi HEX) sebagai berikut:
A = 01234567
B = 89ABCDEF
C = FEDCBA98
D = 76543210
Langkah-langkah

4. Pengolahan Pesan dalam Blok 512 bit


Pesan dibagi menjadi L buah blok yang masing-masing panjangnya 512 bit (Y0 sampai YL – 1).
 

Setiap blok 512-bit diproses bersama dengan penyangga MD menjadi keluaran 128-bit, dan ini
disebut proses HMD5. Gambaran proses HMD5 diperlihatkan pada Gambar 13.3.
Langkah-langkah

Yq menyatakan blok 512-bit ke-q dari pesan yang


telah ditambah bit-bit pengganjal dan tambahan
64 bit nilai panjang pesan semula.

MDq adalah nilai message digest 128-bit dari


proses HMD5 ke-q. Pada awal proses, MDq berisi
nilai inisialisasi penyangga MD.

Proses HMD5 terdiri dari 4 buah putaran:


• Masing-masing putaran melakukan operasi
dasar MD5 sebanyak 16 kali
• Operasi dasar melibatkan fungsi fF, fG, fH, dan
fI .
• Setiap operasi dasar memakai sebuah elemen
T.
• Jadi setiap putaran memakai 16 elemen Tabel
T.
Operasi dasar MD5

a  b + CLSs(a + g(b, c, d) + X[k] + T[i])

a, b, c, d = empat buah peubah penyangga 32-bit


(berisi nilai penyangga A, B, C, D)
 
g = salah satu fungsi F, G, H, I
 
CLSs = circular left shift sebanyak s bit
 
X[k] = kelompok 32-bit ke-k dari blok 512 bit
message ke-q. Nilai k = 0 sampai 15.
 
T[i] = elemen Tabel T ke-i (32 bit)
 
+ = operasi penjumlahan modulo 232
Langkah-langkah

Fungsi dasar MD5


Langkah-langkah

Karena ada 16 kali operasi dasar, maka setiap


kali selesai satu operasi dasar, penyangga-
penyangga itu digeser ke kanan secara sirkuler
dengan cara pertukaran sebagai berikut:
  temp  d
d  c
c  b
b  a
a  temp
Langkah-langkah
Langkah-langkah

 Misalkan notasi
 
[abcd k s i]
 
menyatakan operasi
 

a  b + ((a + g(b, c, d) + X[k] + T[i])<<<s)


Dalam hal ini <<<s melambangkan operasi circular left shift 32-bit
Langkah-langkah

a  b + ((a + g(b, c, d) + X[k] + T[i])<<<s)


Langkah-langkah

a  b + ((a + g(b, c, d) + X[k] + T[i])<<<s)


Langkah-langkah

a  b + ((a + g(b, c, d) + X[k] + T[i])<<<s)


Langkah-langkah

a  b + ((a + g(b, c, d) + X[k] + T[i])<<<s)


Langkah-langkah

Setelah putaran keempat, a, b, c, dan


d ditambahkan ke A, B, C, dan D,

Selanjutnya algoritma memproses


blok data berikutnya (Yq+1).

Keluaran akhir dari algoritma MD5


adalah hasil penyambungan bit-bit di
A, B, C, dan D.
EXERCISE

• Create a program for encryption and decryption using CBC.

• Deadline H+7.
THANKS!
Do you have any questions?
[email protected]

+91 620 421 838 yourcompany.com

CREDITS: This presentation template was


created by Slidesgo, including icons by Flaticon,
infographics & images by Freepik

Please keep this slide for attribution

You might also like