LatihanKriptografi Teks SinComp 2023

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

In[359]:= alphabet = CharacterRange@"a", "z"D

ToCharacterCode@alphabetD

numerik = Range@33, 125D


FromCharacterCode@numerikD

neoalphabet = :" æ ">


ToCharacterCode@neoalphabetD

Out[359]= :a, b, c, d, e, f , g, h, i, j, k, l , m, n, o, p, q , r, s, t, u, v , w, x, y, z>

Out[360]= 8897<, 898<, 899<, 8100<, 8101<, 8102<, 8103<, 8104<,


8105<, 8106<, 8107<, 8108<, 8109<, 8110<, 8111<, 8112<, 8113<,
8114<, 8115<, 8116<, 8117<, 8118<, 8119<, 8120<, 8121<, 8122<<

Out[361]= 833, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125<

Out[362]= !" ð $ % & 'HL* +,-. 0123456789:;<= > ? ž ABCDEFGHIJKLMNOPQRSTUVWXYZ @ \ D^


_`abcdefghijklmnopqrstuvwxyz8È<

Out[363]= : æ >

Out[364]= 88360, 485, 570, 525, 160, 525, 550, 525, 160, 575, 485, 605, 485, 160, 160, 545, 505,
550, 505, 570, 525, 545, 485, 160, 490, 525, 550, 515, 535, 525, 575, 485, 550, 230<<

In[365]:= A = MatrixForm@881, 2<, 82, - 1<<D


B = MatrixPower@881, 2<, 82, - 1<<, 2D
A2 = MatrixForm@BD
A3 = MatrixForm@MatrixPower@881, 2<, 82, - 1<<, 3DD
A4 = MatrixForm@MatrixPower@881, 2<, 82, - 1<<, 4DD
Out[365]//MatrixForm=

K O
1 2
2 -1
Out[366]= 885, 0<, 80, 5<<
Out[367]//MatrixForm=

K O
5 0
0 5
Out[368]//MatrixForm=

K O
5 10
10 - 5
Out[369]//MatrixForm=

K O
25 0
0 25
2 LatihanKriptografi_Teks_SinComp_2023.nb

In[370]:= Simplify@NestList@Apply@Function@8x, y<, 8 x + 2 y , 2 x - y <D, ðD &, 8x, y <, 4DD

Out[370]= 88872, 97, 114, 105, 32, 105, 110, 105, 32, 115, 97, 121, 97, 32, 32, 109, 101<,
8110, 101, 114, 105, 109, 97, 32, 98, 105, 110, 103, 107, 105, 115, 97, 110, 46<<,
88292, 299, 342, 315, 250, 299, 174, 301, 242, 335, 303, 335, 307, 262, 226, 329, 193<,
834, 93, 114, 105, - 45, 113, 188, 112, - 41, 120, 91, 135, 89, - 51, - 33, 108, 156<<,
88360, 485, 570, 525, 160, 525, 550, 525, 160, 575, 485, 605, 485, 160, 160, 545, 505<,
8550, 505, 570, 525, 545, 485, 160, 490, 525, 550, 515, 535, 525, 575, 485, 550, 230<<,
881460, 1495, 1710, 1575, 1250, 1495, 870, 1505, 1210, 1675, 1515,
1675, 1535, 1310, 1130, 1645, 965<, 8170, 465, 570, 525, - 225,
565, 940, 560, - 205, 600, 455, 675, 445, - 255, - 165, 540, 780<<,
881800, 2425, 2850, 2625, 800, 2625, 2750, 2625, 800, 2875, 2425, 3025,
2425, 800, 800, 2725, 2525<, 82750, 2525, 2850, 2625, 2725, 2425,
800, 2450, 2625, 2750, 2575, 2675, 2625, 2875, 2425, 2750, 1150<<<

In[371]:= text = "Hari ini saya menerima bingkisan."


Out[371]= Hari ini saya menerima bingkisan.

In[372]:= str1 = StringTake@text, 81, Round@StringLength@textD  2D<D


str2 = StringTake@text, 8Round@StringLength@textD  2D + 1, StringLength@textD<D
Out[372]= Hari ini saya me

Out[373]= nerima bingkisan.

In[374]:= StringLength@str1D
StringLength@str2D
Out[374]= 17

Out[375]= 17
LatihanKriptografi_Teks_SinComp_2023.nb 3

In[376]:= A = ToCharacterCode@str1D
B = ToCharacterCode@str2D
AccountingForm@Grid@Partition@A, 9DDD;
AccountingForm@Grid@Partition@B, 9DDD;
x = A;
y = B;
power = 3;
ambildata1 = Table@Take@8x@@nDD, y@@nDD<D, 8n, Round@StringLength@textD  2D<D;
sandi1 =
Simplify@NestList@Apply@Function@8x, y<, 8 x + 2 y , 2 x - y <D, ðD &, 8x, y <, powerDD

sandi = StringJoin@Flatten@FromCharacterCode@Abs@Round@sandi1@@powerDDDDDDD
ImportString@sandiD
Out[376]= 872, 97, 114, 105, 32, 105, 110, 105, 32, 115, 97, 121, 97, 32, 32, 109, 101<

Out[377]= 8110, 101, 114, 105, 109, 97, 32, 98, 105, 110, 103, 107, 105, 115, 97, 110, 46<

Out[384]= 88872, 97, 114, 105, 32, 105, 110, 105, 32, 115, 97, 121, 97, 32, 32, 109, 101<,
8110, 101, 114, 105, 109, 97, 32, 98, 105, 110, 103, 107, 105, 115, 97, 110, 46<<,
88292, 299, 342, 315, 250, 299, 174, 301, 242, 335, 303, 335, 307, 262, 226, 329, 193<,
834, 93, 114, 105, - 45, 113, 188, 112, - 41, 120, 91, 135, 89, - 51, - 33, 108, 156<<,
88360, 485, 570, 525, 160, 525, 550, 525, 160, 575, 485, 605, 485, 160, 160, 545, 505<,
8550, 505, 570, 525, 545, 485, 160, 490, 525, 550, 515, 535, 525, 575, 485, 550, 230<<,
881460, 1495, 1710, 1575, 1250, 1495, 870, 1505, 1210, 1675, 1515,
1675, 1535, 1310, 1130, 1645, 965<, 8170, 465, 570, 525, - 225,
565, 940, 560, - 205, 600, 455, 675, 445, - 255, - 165, 540, 780<<<

Out[385]= æ

Out[386]= 8104, 229, 58, 13, 160, 13, 38, 13, 160, 63, 229, 93, 229, 160, 160, 33,
249, 38, 249, 58, 13, 33, 229, 160, 234, 13, 38, 3, 23, 13, 63, 229, 38, 230<
4 LatihanKriptografi_Teks_SinComp_2023.nb

Pelajari bentuk program Mathematica diatas . Kemudian lakukan latihan berikut ini :

Pandang Matriks berikut :

H = MatrixForm @ 8 8 0.5 , 2.5 < , 8 2.0 , 1.5 < < D

Tentukan Bentuk Sandi Rahasia dari kalimat  teks berikut :

" In the next section we will use the map in Eq . H7 L to construct a cryptographic
algorithm for the digital image . We use Mathematica® scripts
to implement our proposed encryption -description algorithm .
In addition we make a comparison of encryption -decryption
results between map in Eq . H7 L and Arnold 's Cat Map HACM L."

You might also like