Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all
- clear all
- clc
- %Open and read text
- fid = fopen('inputFile/10.txt');
- t=fread(fid);
- fclose(fid);
- %Set key
- %key = 'ABC12-EFGHI34JKLMN56O'
- kayfile = fopen('C:\Users\Jakub\Desktop\STIOD-decrypt\hasla.txt');
- tline = fgetl(kayfile);
- formatSpec = '%f';
- tline = fgetl(kayfile);
- keys = [];
- i=1;
- while ischar(tline)
- A = strread(tline,formatSpec)
- tline = fgetl(kayfile);
- keys[i] = A;
- i++;
- end
- fclose(kayfile);
- %Encrypt text
- EncryptedData = OneTimeEncrypt( t,key);
- %Save encrypted text
- fid = fopen('PanTadeuszEnc.txt', 'w+');
- fwrite(fid, EncryptedData);
- %Decrypt text
- DecryptedData = OneTimeEncrypt(EncryptedData,-key);
- %Save encrypted text
- fid = fopen('PanTadeuszDecr.txt', 'w+');
- fwrite(fid, DecryptedData);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement