Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
%NPM: 1306464354
%menghapus semua variable yg sudah disimpan
clear;
%clear screen
clc;
baca = fopen('file.txt');
tmp1 = textscan(baca, '%c');
matriks1 = ['ABCDEFGHIJKLMNOPQRSTUVWXYZ_'];
matriks2 = [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26];
pesan = tmp1{1};
enkripsi = [9 10; 7 9];
panjangpesan = length(pesan);
% iterasi pencarian
for i = 1: panjangpesan
indeks = find(matriks1 == pesan(i));
nilaipesan(i) = matriks2(indeks);
end
i = 1;
%mengalikan setiap vektor dgn matriks enkripsi dan hasilnya di modulo
%dengan 27
while i <= panjangpesan
j = i+1;
perhitungan = mod(enkripsi*([nilaipesan(i);nilaipesan(j)]), 27);
pesanmod(i) = perhitungan(1);
pesanmod(j) = perhitungan(2);
i = i+2;
end
%konversi dari vektor ke alfabet
for j = 1: panjangpesan
indeks = find(matriks2 == pesanmod(j));
cipher(j) = matriks1(indeks);
end
cipher
%cari modulo invers
detEnkripsi = round(det(enkripsi));
[g,c,d] = gcd(detEnkripsi,27);
moduloinvers = mod(c,27);
%matriks dekripsi
matriksDekripsi = inv(enkripsi)*det(enkripsi)*moduloinvers;
%declare k
k = 1;
while k <= panjangpesan
l = k+1;
perhitungan =round(mod(matriksDekripsi*([pesanmod(k);pesanmod(l)]), 27));
pesanDekripsi(k) = perhitungan(1);
pesanDekripsi(l) = perhitungan(2);
k = k + 2;
end
%konversi perhitungan ke alfabet
for a = 1: panjangpesan
indeks = find(matriks2 == pesanDekripsi(a));
alfabet(a) = matriks1(indeks);
end
alfabet
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team