Sabtu, 14 September 2019

Perhitungan manual Algoritma RSA


For Example :

p value is 47
q value is 71
public key value is 79
Message : "HARI INI"

Question :
How Is Encryption And Decryption Process ?

Answer :

MANUAL RSA ENCRYPTION PROCESS

Prime 1 (p) value :47
Prima 2 (q) value :71
public (e) key :79
N (p x q) value :3337
phi (N) --> (p-1) x (q-1) :3220
Private Key (d) : (1+k*3220)/79; k=1,2,3,....
find d with rounded results by trying k values
obtained private key value (d) :1019
So :
Public Key : (79,3220)
Private Key: (1019,3220)

Message (M) = HARI INI

===============
ENCRYPTION PROCESS
===============

Convert Message to Decimal Format
H = 72
A = 65
R = 82
I = 73
  = 32
I = 73
N = 78
I = 73

For this encryption process, I break m into smaller blocks, for example m is broken into six blocks that require 3 digits

M0=726
M1=582
M2=733
M3=273
M4=787
M5=003

CipherText (C) = Plaintext (M) ^ e mod N

C0 = 726 ^ 79 mod 3337 = 215
C1 = 582 ^ 79 mod 3337 = 776
C2 = 733 ^ 79 mod 3337 = 1743
C3 = 273 ^ 79 mod 3337 = 933
C4 = 787 ^ 79 mod 3337 = 1731
C5 = 3 ^ 79 mod 3337 = 158

CipherText: 215.776.1743.933.1731.158

Plaintext (M) =Ciphertext (C) ^ d mod N

P0 = 215 ^ 1019 mod 3337 = 726
P1 = 776 ^ 1019 mod 3337 = 582
P2 = 1743 ^ 1019 mod 3337 = 733
P3 = 933 ^ 1019 mod 3337 = 273
P4 = 1731 ^ 1019 mod 3337 = 787
P5 = 158 ^ 1019 mod 3337 = 3

Convert Desimal to Ascii
Return Decryption
72=H
65=A
82=R
73=I
32=
73=I
78=N
73=I

---- FINISH----

Tidak ada komentar:

Posting Komentar