[issue3745] _sha256 et al. encode to UTF-8 by default
Hagen Fürstenau
report at bugs.python.org
Mon Sep 1 11:27:06 CEST 2008
New submission from Hagen Fürstenau <hfuerstenau at gmx.net>:
Whereas openssl-based _hashlib refuses to accept unencoded strings:
>>> _hashlib.openssl_sha256("\xff")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object supporting the buffer API required
the _sha256 version encodes to UTF-8 by default:
>>> _sha256.sha256("\xff").digest() ==
_sha256.sha256("\xff".encode("utf-8")).digest()
True
I think refusing is better, but at least the behaviour should be
consistent. Same for the other algorithms in hashlib.
----------
components: Library (Lib)
messages: 72220
nosy: hagen
severity: normal
status: open
title: _sha256 et al. encode to UTF-8 by default
type: behavior
versions: Python 3.0
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3745>
_______________________________________
More information about the Python-bugs-list
mailing list