Im trying to encrypt a password to be held in a database, however I need to know the password to authenticate against another system so need to be able to decrpyt it again.
So to encrypt the password Im using:-
INSERT INTO `suppliers`.`users` (`username`, `password`) VALUES ('user1', AES_ENCRYPT('mypassword','cryptstring'))
And then to decypt it Im using:-
SELECT `username`, unhex(AES_DECRYPT(`users`.`password`,'cryptstring')) FROM `suppliers`.`users`
Which should work, however it returns as a decrpted password as '6d7970617373776f7264' which I initally thought was HEX representation of the password but when I try to run it through unhex it just returns null