How can I encrypt the username and email address in the database, to protect against emails being stolen from a compromised database (D7) Is there a way to encrypt the following user fields in the database so that they cannot be retrieved from a compromised database? 


Username
Email address


A solution to encrypt the whole database would also be great.
If you want encrypt it, it means you need to decrypt it. So it means that the algorithm that encrypt and decrypt are available somewhere in your application or drupal files.

I guess if the user that has access to your database he has also access to your files, or at least I guess he can have access easily.

And in that case, encrypted datas are useless.

The most important its to hash the password with algorithms like SHA1 and use a salt or private key, thing that Drupal 7 is doing.

This is just my point of view, but if you want do it what you can use this module http://drupal.org/project/aes and with some user hooks, such as hook_user_presave() and hook_user_load().

The trick in this case it's that your module should be the last one before saving save the data and be the first one that decrypt data.