note 59841 deleted from function.md5 by joey

From: Date: Sun, 17 Jul 2011 08:42:38 +0000
Subject: note 59841 deleted from function.md5 by joey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181612@lists.php.net to get a copy of this message
Note Submitter: Andrew Nelless ( anelless _ gmail _com ) ---- "mina86 at tlen dot pl"'s (19-Sept-05) HMAC-MD5 implementation is correct but his example usage provides little practical advantage over the simple concatenation and hash approach to salting. $hash = md5($salt . $password); On the other hand, a good use for a MAC (with a server side private key) would be to store one in the users cookie in order to verify that cookie's (or parts of them) you issue haven't been changed manually (or for that matter, by any other website (maybe via a XSS browser exploit?), MITM attack or evil proxy). Such a trick allows you to put mildly critical data about a user, that you don't want changed by anyone but you, in their cookie rather than in your database. This could have advantages (openness, not needing to store user email addresses at the server side once they have been verified by email, even do away with the need to store data about a poster in a server side database altogether but still being able to allow these almost anonymous posters to come along and edit their submissions with confidence) and be rather entertaining (users trying to crack their cookie code to elevate their stats and/or permissions). This is like issueing a passport. The traveller can see all of it, get it stamped (~customise parts of it) but can also invalidate it and have it revoked. It can also save on expensive and time consuming nationality/immigration checks (~using the database) at the airport (~the server side).

« previous php.notes (#181612) next »