Search the Community
Showing results for tags 'aes_encrypt'.
I've been having trouble understanding what exactly the salt argument and its purpose are. Can someone explain it in context (give an example?)? I've also been having some trouble with step 4 in the example in the book. I'm using phpMyAdmin and when I type in the code, it says that 'nacl' is not identified. Is this normal? If so, is there a way I can get around it or do I have to use the shell? Thanks!
Hi, I have been following through the exercises in your book, and until now have been getting on fine. However I don't seem to be able to salt the password in the way described in the book in Chapter 7, page 238-239. I run the column creation queries; ALTER TABLE customers ADD COLUMN pin VARBINARY(16) NOT NULL; ALTER TABLE customers ADD COLUMN nacl CHAR(20) NOT NULL; Then I run the salt and password setting on one of the columns; UPDATE customers SET nacl = SUBSTRING(MD5(RAND()), -20) WHERE customer_id=1; UPDATE customers SET pin=AES_ENCRYPT(1234, nacl) WHERE customer_id=1; But for some reason, when I run the select query to view it, I get the following; customer_id = 1 first_name = Sarah last_name = Vowell nacl = 3df7829e4678b0d3e34c pin = f1c0318bbf8fe261e32c3a6f821561b7 The pin has been set as alphanumeric rather than in the unreadable format. It is also 32 characters rather than the 16 I set the column to. Do you know why this is happening? Regards Jon