Java Method That works like MySQL function AES_ENCRYPT

Closed - This job posting has been filled.

Job Description

We have a database that has a field "password" that contains an encrypted password:

select
hex(password),
hex(AES_ENCRYPT('password','password') )
from
member where id='themember'

The output of the above SQL is:

# hex(password), hex(AES_ENCRYPT('password','password') )
'70FB3363637D6484723610B7837BEE9B', '70FB3363637D6484723610B7837BEE9B'

If the password was "password" this would have been used to create the encrypted value:

AES_ENCRYPT('password','password')

We require a Java class we can use like this:

AesEncryptHashUtils.isMatchedPassword("mypassword","encryptedbase64stringhere","mypassword");

boolean AesEncryptHashUtils.isMatchedPassword(String encryptionKey, String hexEncryptedPassword, String clearTextPassword);

Where:

encryptionKey = the password in clear text. Used as the encryption key. e.g. "password"
hexEncryptedPassword = the password encrypted using itself as the key and then turned into a hex string. e.g. "70FB3363637D6484723610B7837BEE9B"
clearTextPassword = the password in clear text as entered by the user. e.g. "password"

The method returns true if the value in hexEncryptedPassword equals the value in clearTextPassword.

The job is to create a class that implements the AES_ENCRYPT logic in pure Java code (or libs that are part of Java 1.6 Standard)