My experiment with packaging and encrypting sounds with Python

Hello all,
Well, in BGT we have the ability to pack and encrypt sounds for security reasons. Well, I wanted to get the same with Python, so for two days I was googleing and playing around with file encryption and decryption in Python with pycrypto. Basically, what I wanted to achieve is as follows:
1. Put all wave files and other game data files inside a zip file.
2. Encrypt the zip file so cheeters cannot modify game data, and also to prevent users from modifying sound files.
3. When the game needs access to sounds and other secret data, decrypt the zip file with previously set encryption key, but data from decrypted zip must be extracted and accessed from within computer's ram, not from a hard drive, again to prevent users from accessing data inside a package.
Fortunately, I was able to achieve all of that, and here's the result (coded in Python 2.7): https://dl.dropboxusercontent.com/u/407 … eriment.7z
However, there's one issue that I'm aware of.
Since I wanted to load wave files from memory directly without accessing hard drive, I had to use Python's wave module and python's io.BytesIO to get this working. But wave module returns wave data as waveform bytes (I think), while some other sound libraries such as LibAudioVerse require array with floats that represent sound data. Fortunately, I was able to get to my friend Google and find some kind of solution on stackoverflow, but this solution has one limitation. You cannot convert 24-bit or hire wave data, only 16-bit. So inside a zip file I have two wave files, splash.wav and telephone.wav. The splash.wav plays normally, however if you try to play the second one you will get an error. Some other Python audio modules such as PyMedia and probably PyAl don't require any conversion. For sound_lib AKA BASS I have no idea.
For this code to work, you need Python27, Libaudioverse 0.9A7, and PyCrypto. LAV and I think PyCrypto are both available on pip.
Anyway, at the link above is entire code that I was working on for two days, so please give any feedback regarding security, speed and loading packed sound data:
Thanks!

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector

Reply via email to