Fast, "Cheap" Image Encryption
I have a need of a function/library that can quickly encrypt an image on a low-powered device (cell phone, tablet, etc).
I need to provide a string which can act as a password to encrypt and decrypt the image file.
Ideally, I would like something that retains the image file format and just scrambles the pixels. I have tried prototyping this and haven't been able to find an efficient method to do so (10-30 seconds to encrypt on a PC, crashes on device). The idea here is to visually show the user that their image has been encrypted. I realize that I may have to fake this feature, or do without it completely.
I need the image file to be encrypted on the client and sent to a server w开发者_StackOverflow社区here it can be stored without the user worrying about who can access it. The encryption doesn't have to be terribly tough (referring to the NSA question). The image file will then later be downloaded by the user and decrypted with a password.
Is there anything out there that fits this description?
I'd try AES. Often the encryption is much less of a bottle neck than other steps, such as image compression. But of course, whithout knowing any specific details of your setup it is hard to make reliable predictions.
RC4 algorithm is fast (it's basicly XOR operation with really good session key) and flexible, if you find implementation for it for your cellphone platform. Be aware, though, that RC4 requires perfect session key, i.e. good source of random data first of all. RC4 standard (IIRC) has specification for such randomizer but I don't know if all libraries, that provide encryption itself also offer randomization function.
Note, that cryptographically strong randomizer can't be replaced by regular rand() or similar functions.
What is image encryption? you mean Steganography? (Hiding data inside images?)
or image compression? such as PNG/GIF/Jpeg?
if you just mean encryption cipher there is many you can pick out Blowfish/RSA/DES/AES/Rijndael which encrypt the actual data that makes up the image.
精彩评论