New submission from Mahmoud Abdelkader <mabdelka...@gmail.com>:

Given a string, encoding it with .encode('base64') is not the same as using 
base64's b64encode function. I think this is very unclear and unintuitive. 

Here's some example code to demonstrate the problem. Before I attempt to submit 
a patch, is this done for legacy reasons? Are there any reasons to use one over 
the other?

import hmac
import hashlib
import base64


signature = hmac.new('secret', 'url', hashlib.sha512).digest()
assert signature.encode('base64') == base64.b64encode(signature)

----------
components: Library (Lib)
messages: 126696
nosy: mahmoudimus
priority: normal
severity: normal
status: open
title: "string".encode('base64') is not the same as base64.b64encode("string")
versions: Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10970>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to