TeddyKGB Posted June 8, 2013 Share Posted June 8, 2013 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 Link to comment Share on other sites More sharing options...
TeddyKGB Posted June 8, 2013 Author Share Posted June 8, 2013 Just to add what verions I am on; Database server Server: 127.0.0.1 via TCP/IP Software: MySQL Software version: 5.5.27 - MySQL Community Server (GPL) Protocol version: 10 User: root@localhost Server charset: UTF-8 Unicode (utf8)Web server Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Database client version: libmysql - mysqlnd 5.0.10 - 20111026phpMyAdmin Version information: 3.5.2.2, latest stable version: 4.0.3 Link to comment Share on other sites More sharing options...
Larry Posted June 10, 2013 Share Posted June 10, 2013 Offhand, I don't know why that's happening. You're seeing this in phpMyAdmin? Link to comment Share on other sites More sharing options...
TeddyKGB Posted June 12, 2013 Author Share Posted June 12, 2013 Yes I am seeing it in phpMyAdmin, this is how it is stored in the table. Because this is just a result of the queries listed above (and I have re-run and double checked them many times), I am not sure how else to debug this. I am continuing on through the book and haven't had any other issues yet (up to Chapter 10). Any help would be much appreciated, the book has been very useful so far! Regards Jon Link to comment Share on other sites More sharing options...
Larry Posted June 13, 2013 Share Posted June 13, 2013 Yes I am seeing it in phpMyAdmin, this is how it is stored in the table. Actually, it's that assumption that I'm trying to validate. It's possible that phpMyAdmin is doing something here. Are you comfortable using the command-line mysql client to see if the results are the same there? Link to comment Share on other sites More sharing options...
TeddyKGB Posted June 13, 2013 Author Share Posted June 13, 2013 Problem solved! You were right, it is just something to do with how phpMyAdmin is presenting the table. When I run the select from cmd, it shows it in the unreadable format of characters. Thanks Larry, much appreciated. Very good book. Regards Jon Link to comment Share on other sites More sharing options...
Larry Posted June 14, 2013 Share Posted June 14, 2013 Excellent. Glad that's resolved and thanks for the nice words! Link to comment Share on other sites More sharing options...
Recommended Posts