Advertisement
Ham62

encrypt.bas

Oct 10th, 2017
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "crt.bi"
  2. Dim FileBuff as ubyte ptr
  3.  
  4. if Command = "" or Command = "/?" then
  5.     Print !"Simple File Encryptor 1.000\r\n"
  6.     Print !"syntax: encrypt 'filename'\r\n"
  7.     Print "to de-encrypt run program a second time over file as it's a self-decrypting"
  8.     Print "algorithm"
  9. End If
  10.  
  11. 'open input file
  12. Open command for binary access read as #1
  13. var iFileSz = lof(1)
  14. FileBuff = malloc(iFileSz)
  15. Get #1, , FileBuff[0], iFileSz: Close #1
  16.  
  17. 'encrypt data
  18. For X as integer = 0 to iFileSz
  19.     FileBuff[X] = FileBuff[X] XOR &HFF
  20. Next X
  21.  
  22. 'open output file
  23. Open command for binary access write as #1
  24. Put #1,, FileBuff[0], iFileSz: Close #1
  25.  
  26. Free FileBuff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement