Sei sulla pagina 1di 35

Application of Integer:

Cryptography

11/10/2018 budi murtiyasa / application of Integer 1


CIPHERTEXT

PB QDPH LV EXGL PEUWLBDVD

SHIFT 3 LETTERS

MY NAME IS BUDI MURTIYASA


PLAINTEXT
introduction
• Cryptography (derived from the Greek), Kripto
(hidden) and grafia (something which is
written).
• Cryptography : something (written / message)
to hide or to make secrecy
• objectives: written or message are unread by
any person.

11/10/2018 budi murtiyasa / application of Integer 3


• Cryptography concern with development of
algorithm which used to :
– hide a message from any person, except between
sender and receiver, and/or
– Verify a message, and/or
– Verify a sender and reciever

11/10/2018 budi murtiyasa / application of Integer 4


Some definitions(1)
• Cryptography can be define as method to
transforms a message into secret form and its
back.

11/10/2018 budi murtiyasa / application of Integer 5


Some definitions(2)
• Cryptography is a science which studying
about how to make a message still secure on
delivering from the sender to receiever.
• Cryptography is the art and science of keeping
messages secure

11/10/2018 budi murtiyasa / application of Integer 6


Some terminology
• The original intelligible message called
plaintext.
• A message which is hidden, the transformed
message called ciphertext.
• Cipher is an algorithm which is used to
transform plaintext into ciphertext

11/10/2018 budi murtiyasa / application of Integer 7


Data Encryption

message
message
encrypt decrypt
ciphertext Plaintext
Plaintext

11/10/2018 budi murtiyasa / application of Integer 8


Some terminology(2)
• key is some critical-information used by the
cipher. The key is only known to sender and
receiver.
• Encipher is process to convert plaintext into
ciphertext using a cipher and a key
• Decipher is process to convert ciphertext back
to plaintext using a cipher and a key.

11/10/2018 budi murtiyasa / application of Integer 9


Hill Ciphers
Hill Ciphers
• Created by Lester S. Hill in 1929
• Polygraphic Substitution Cipher
• Uses matrices to encrypt and decrypt
• Uses modular arithmetic (Mod 26)
Hill Cipher Matrices
• One matrix to encrypt, one to decrypt
• Must be n x n, invertible matrices
• Decryption matrix must be modular inverse of
encryption matrix in Mod 26
Modularly Inverse Matrices
• Calculate determinant of first matrix A, det(A)
• Make sure that det(A) has a modular inverse
for Mod 26
• Calculate the adjoint of A, adj(A)
• Multiply adj(A) by modular inverse of det(A)
• Calculate Mod 26 of the result to get B
• Use A to encrypt, B to decrypt
Modular Reciprocal Example
Encryption
• Assign each letter in alphabet a number
between 0 and 25
• Change message into 2 x 1 letter vectors
• Change each vector into 2 x 1 numeric vectors
• Multiply each numeric vector by encryption
matrix
• Convert product vectors to letters
Letter to Number Substitution
A B C D E F G H I J K L M
0 1 2 3 4 5 6 7 8 9 10 11 12

N O P Q R S T U V W X Y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
Change Message to Vectors
Message to encrypt = HELLO WORLD
Multiply Matrix by Vectors
Convert to Mod 26
Convert Numbers to Letters

HELLO WORLD has been encrypted to


SLHZY ATGZT
Decryption
• Change message into 2 x 1 letter vectors
• Change each vector into 2 x 1 numeric vectors
• Multiply each numeric vector by decryption
matrix
• Convert new vectors to letters
Change Message to Vectors
Message to encrypt = SLHZYATGZT
Multiply Matrix by Vectors
Convert to Mod 26
Convert Numbers to Letters

SLHZYATGZT has been decrypted to


HELLO WORLD
RSA Ciphers
Algoritma RSA
• Ditemukan oleh tiga peneliti dari MIT
(Massachussets Institute of Technology), yaitu
Ron Rivest, Adi Shamir, dan Len Adleman,
pada tahun 1976.

• Termasuk algoritma kriptografi nirsimetri.

27
• Setiap pengguna mempunyai sepasang kunci:
1. Kunci publik: untuk enkripsi
2. Kunci privat: untuk dekripsi

• Kunci publik tidak rahasia (diketahui semua


orang/umum), kunci privat rahasia (hanya
diketahui pemilik kunci saja)

28
Pembangkitan pasangan kunci
1. Pilih dua bilangan prima, a dan b (rahasia)
2. Hitung n = a b. Besaran n tidak perlu dirahasiakan.
3. Hitung m = (a – 1)(b – 1).
4. Pilih sebuah bilangan bulat untuk kunci publik, sebut
namanya e, yang relatif prima terhadap m.
5. Hitung kunci dekripsi, d, melalui d  1 (mod m).

29
Enkripsi
1. Nyatakan pesan menjadi blok-blok plainteks: p1, p2,
p3, … (harus dipenuhi persyaratan bahwa nilai pi
harus terletak dalam himpunan nilai 0, 1, 2, …, n – 1
untuk menjamin hasil perhitungan tidak berada di
luar himpunan)
2. Hitung blok cipherteks ci untuk blok plainteks pi
dengan persamaan
ci = pie mod n
yang dalam hal ini, e adalah kunci publik.

30
Dekripsi
Proses dekripsi dilakukan dengan menggunakan
persamaan
pi = cid mod n,
yang dalam hal ini, d adalah kunci privat.

31
• Contoh. Misalkan a = 47 dan b = 71 (keduanya
prima), maka dapat dihitung
n = a  b = 3337
m = (a – 1)(b – 1) = 3220.

• Pilih kunci publik e = 79 (yang relatif prima dengan


3220 karena pembagi bersama terbesarnya adalah
1).

• Nilai e dan n dapat dipublikasikan ke umum.

32
• Selanjutnya akan dihitung kunci dekripsi d dengan
kekongruenan:
e  d  1 (mod m)

1  (k  3220 )
d
79
Dengan mencoba nilai-nilai k = 1, 2, 3, …, diperoleh
nilai d yang bulat adalah 1019. Ini adalah kunci
dekripsi.

33
• Misalkan plainteks P = HARI INI

atau dalam desimal ASCII: 7265827332737873

Pecah P menjadi blok yang lebih kecil (misal 3 digit):


p1 = 726 p4 = 273
p2 = 582 p5 = 787
p3 = 733 p6 = 003

34
• Enkripsi setiap blok:
c1 = 72679 mod 3337 = 215
c2 = 58279 mod 3337 = 776
dst untuk sisa blok lainnya
Keluaran: chiperteks C = 215 776 1743 933 1731
158.

• Dekripsi (menggunakan kunci privat d = 1019)


p1 = 2151019 mod 3337 = 726
p2 =7761019 mod 3337 = 582
dst untuk sisi blok lainnya
Keluaran: plainteks P = 7265827332737873
yang dalam ASCII karakternya adalah HARI INI.
35

Potrebbero piacerti anche