Speading encryption

BlitzPlus Forums/BlitzPlus Programming/Speading encryption

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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
	Forever
Change 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.