Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. close all
  2. clear all
  3. clc
  4.  
  5. %Open and read text
  6. fid = fopen('inputFile/10.txt');
  7. t=fread(fid);
  8. fclose(fid);
  9.  
  10. %Set key
  11. %key = 'ABC12-EFGHI34JKLMN56O'
  12. kayfile = fopen('C:\Users\Jakub\Desktop\STIOD-decrypt\hasla.txt');
  13.  
  14. tline = fgetl(kayfile);
  15. formatSpec = '%f';
  16.  
  17. tline = fgetl(kayfile);
  18. keys = [];
  19.  
  20. i=1;
  21. while ischar(tline)
  22. A = strread(tline,formatSpec)
  23. tline = fgetl(kayfile);
  24. keys[i] = A;
  25. i++;
  26. end
  27. fclose(kayfile);
  28.  
  29.  
  30. %Encrypt text
  31. EncryptedData = OneTimeEncrypt( t,key);
  32. %Save encrypted text
  33. fid = fopen('PanTadeuszEnc.txt', 'w+');
  34. fwrite(fid, EncryptedData);
  35.  
  36. %Decrypt text
  37. DecryptedData = OneTimeEncrypt(EncryptedData,-key);
  38. %Save encrypted text
  39. fid = fopen('PanTadeuszDecr.txt', 'w+');
  40. fwrite(fid, DecryptedData);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement