title: Constant result for encryption of string in Java
body: <p>I would like to encrypt a string ( user's email ) and always obtain the same resulting string
  I am saving the user's email as login user name, because I have searches on that field ( for example, user's email already exists when registering. Or select user's password where email = 'abc' )</p>
  
  <p>For password encryption and decryption I use Jasypt which does the job.</p>
  
  <p>String encryption, I can encrypt and decrypt but I haven't found a way to have the decryption constant.</p>
  
  <p>I have searched a lot for the solution but none seem to address my problem. It is possible I am not using the right keywords, I am not familiar with encryption.</p>
  
  <p>I don't have to use Jasypt for the string encryption. anything that transforms "hello@hello.com" into "@ABC#EFG" <em>every time</em> would be great.</p>
  
  <p>I have also tried scrambling the bytes of the string using different scrambling algorithms according to length of string, first letter etc. Unfortunately, it stops working when I save the encrypted string in MySQL. From what I understand, every byte which ends up having a Unicode value that MySQL doesn't like is not saved correctly ( it works fine when I use a string present in the test class, but not when I actually save encrypted String and retrieve from DB )</p>
  
  <p>Any ideas - links to solution?</p>
  
  <p>Thanks very much in advance, Dan</p>