Speading encryption
BlitzPlus Forums/BlitzPlus Programming/Speading encryption
| ||
Im trying to make a light encryption program that uses my own personal version of xor so that it xors single bytes rather than integers. Im looking for a few hints on the program. First off, the professional encryption programs out there use what they call "processes" to (as i believe) create several instances of the program to run at once on the computer. This (would) have obvious speed enhancements. Is there any way to do this through blitz? If so can i get an example? Also, would the encryption go faster if I simply used a command such as "output = val(right$(input xor mask,8))"? Are there any other ways to speed my encryption? I would very much appreciate any help you pros out there could give me. |
| ||
Yes I do realize that I spelled speeding wrong in the title. |
| ||
I haven't looked at your 'encryption' code, but I noticed a few misconceptions on your part. First off, professional encryption programs would probably use 'threads' not 'processes'. Processes is a term that more closely approximates a program that is running on your computer. 'Threads' are sub-programs within your program. Secondly, I really can't see how multi-threading would help to en/decrypt faster. Multi-threading is used more efficiently in other scenarios, and is often used to 'share' the CPU, which is often just being nice to the user. But if you want to just 'crunch' numbers as fast as possible, I would stick to a single process running through the entire task without any interruptions. For some better encryption techniques than just your XOR method, check out this page: http://www.cs.usask.ca/resources/tutorials/csconcepts/1999_3/lessons/L3/SimpleEncryption.html Keep clicking on Next to read it all. |
| ||
O.K. yeah you are right I did misuse processes, but is there any way to read/write to/from a file faster than using read/writebytes? Currently it takes about five minutes for a single 444K file to encrypt/decrypt. And to throw off your last suggestion, the reason I used xor is so that I could speed the encryption, at the time it looked faster then the ways suggested in the site which you pointed me to. |
| ||
This is extremely inefficient:Repeat If KeyDown(1) Then Return 0 ;possible exits of main loop If Eof(filein) Then Exit If I Mod(1000) = 0 Then UpdateProgBar(progbar,I/fsize) ;update the progbar WriteByte(fileout,bytexor(ReadByte(filein),buff(I Mod(10)))) ;calls most of the work I = I + 1 ForeverChange it to load a huge amount of data into a bank using the ReadBytes command (NOT ReadByte), convert the data, then store it using the WriteBytes command. In fact, you can then remove the IF part from your If I Mod(1000) = 0 line. And personally, I would change it to more like 10,000 or so because UpdateProgBar is VERY slow. |
| ||
Frick... Wow i really should have looked at my code closer... thanx a lot... I was in the middle of transfering the code to use readbyteS, and i guess I forgot to merge it at the most important parts...sorry for wasting time. |