[issue16063] HMAC trans_5C is a string, causing a TypeError

2012-09-27 Thread Adam Glenn

New submission from Adam Glenn:

When passing 2 unicode objects to hmac.new() I'm getting "TypeError: character 
mapping must return integer, None or unicode" I've tried this using 
hashlib.sha1 and hashlib.md5 and the behavior is the same. What I think is 
happening is that the trans_5C join at the top of this module is a string so 
it's causing the type error when I try to generate the new hmac object at line 
72.

--
components: None
messages: 171384
nosy: Adam.Glenn
priority: normal
severity: normal
status: open
title: HMAC trans_5C is a string, causing a TypeError
type: behavior
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue16063>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16063] HMAC trans_5C is a string, causing a TypeError

2012-10-03 Thread Adam Glenn

Adam Glenn added the comment:

I did some more testing and verified that this is a problem caused by the fact 
that trans_5C is a string and not unicode. It also happens when trans_36 is 
sent to key.translate().

Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hmac
>>> hmac.new(u'key', u'msg')
Traceback (most recent call last):
  File "", line 1, in 
  File "hmac.py", line 132, in new
return HMAC(key, msg, digestmod)
  File "hmac.py", line 72, in __init__
self.inner.update(key.translate(trans_36))
TypeError: character mapping must return integer, None or unicode
>>>

--

___
Python tracker 
<http://bugs.python.org/issue16063>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com