Sunday, April 10, 2011

How to scramble/garble/obfuscate a bitmap image and get it back in c#

A simple way to do it is the follwing method. You pass the last parameter true to obfuscate, false to revert.

The method sadly uses 'unsafe' but you could convert all the pointer operations to Marshal methods.



This method is not very good for images that contain only a few colors, but the "switch" part in the code tries to handle that, and noise the image.

Sample:

No comments:

Post a Comment