print question - character representation
fuzzyman at gmail.com
Fri Aug 27 12:49:49 CEST 2004
Ajay <abra9823 at mail.usyd.edu.au> wrote in message news:<mailman.2504.1093588872.5135.python-list at python.org>...
> 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? if i cant then how can i
> convert the hmac i recalculate on receiving the cookie to the same
> representation as the one printed
One way is to use a binary to ascii conversion - like the binascii module.
More information about the Python-list