Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text encryption
#3
(11-17-2022, 07:59 PM)JRace Wrote: Cool.  I've always had a fascination with crypto, although I am certainly no expert.  I know just enough about the subject to NEVER trust my own work.  Actually, after testing the program below to make sure it worked, I filed it away and it's been my shameful little secret for years, so YOU, dear reader, are among the only people in the world, besides me, who know about this program.

This was written, as a proof-of-concept, for GWBasic back in the bronze age.

It uses a combination of substitution (by adding a "random" number to each byte), and transposition (rearrangement of bytes).

Due to the repeatable nature of the linear consequential random number generator used by GWB (and QB and QB64PE), the sequence of "random" numbers used for encryption may be easily recreated for decryption.

The program asks for the name of an Input File (which is the file you want to encrypt or decrypt), an Output File (which will contain the encrypted or decrypted data), and a Key (which will be used as the "seed" for Basic's built-in pseudo-random number generator).

Exclamation WARNING: Exclamation Be careful with your filename typing; this program does not ask for confirmation if a file with your Output name already exists!
Thank you for this program. I made the modification for output file existence, refusing to do anything in that case. But it's what I chose to do.

Must be tested: run this program a few times to ensure the decrypt/encrypt goes down as expected on the same data set. Then run a program which employs "RANDOMIZE TIMER", run it (hopefully it would be a short time). After that, load this program again and test the decrypt/encrypt like before. It might be easy to emulate eg. the Timex Sinclair random number generator (I read somewhere it just stores 64KB jumbled-up numbers and always refers to that table) but trying to do it for a 16-bit software interpreter and ancient Intel-based processors is harder.

That said, an antidote is to place "RANDOMIZE" statement alone as one of the first lines in the code, then involve the integer that must be input to start, into the encryption.
Reply


Messages In This Thread
Text encryption - by AtomicSlaughter - 11-17-2022, 10:59 AM
RE: Text encryption - by JRace - 11-17-2022, 07:59 PM
RE: Text encryption - by mnrvovrfc - 11-17-2022, 09:03 PM
RE: Text encryption - by bplus - 11-17-2022, 09:25 PM
RE: Text encryption - by JRace - 11-17-2022, 09:57 PM
RE: Text encryption - by bplus - 11-17-2022, 10:03 PM
RE: Text encryption - by SpriggsySpriggs - 11-17-2022, 10:03 PM
RE: Text encryption - by JRace - 11-17-2022, 10:22 PM
RE: Text encryption - by Jack - 11-17-2022, 10:58 PM



Users browsing this thread: 3 Guest(s)