Algorithms and Architectures for Cryptography and Source Coding in Non-Volatile Flash Memories