.ZNG image file format

BlitzMax Forums/BlitzMax Programming/.ZNG image file format

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.

I don't care about people being able to grab media as it's drawn to the card or people that manipulate the actual memory to get your media. Most people have no clue how to do that so I'm not worried about it.

What I am trying to do here is:

bank = LoadBank("myfile.doc")
bank = CompressBank(bank)
bank = EncryptBank(bank)
SaveBank(bank,"myfile.doc.zng")

That's it. I have it all done except for how to effectivey encrypt a bank. Not a string but a bank. It's probably a lot more simple than it looks. I'm just not there yet. Maybe Xor type sucks and I need to use RC4 or z7 who knows.

My current method sucks. I'm doing this:

str$ = LoadString(bank)
str = XorCrypt(str,key)
bstream.writebytes(str,str.length)

Any file size over a few K bytes takes a really long time to encrypt. Now that you know exactly what I'm trying to do:

How would you encrypt a bank of say 128 bytes?