print question - character representation
Brian Gough
bjg at network-theory.co.uk
Fri Aug 27 05:04:13 EDT 2004
Ajay <abra9823 at mail.usyd.edu.au> writes:
> i am calculating a digest of some data (using hmac) and printing it to a
> cookie. the problem is the hash may contain special characters. when these
> are printed they get converted to \<number> representation.
> later when i receive the cookie i recalculate the hmac and do a comparison
> which returns false because of the conversion when writing to a cookie
> q - how do i stop the conversion from happening?
Use the hexdigest() method instead of digest() to avoid non-printable
characters. See the hmac library documentation for details.
--
Brian Gough
Network Theory Ltd,
Publishing the Python Manuals --- http://www.network-theory.co.uk/python/
More information about the Python-list
mailing list