[issue10430] _sha.sha().digest() method is endian-sensitive. and hexdigest()

Kristján Valur Jónsson report at bugs.python.org
Tue Nov 16 08:36:55 CET 2010


New submission from Kristján Valur Jónsson <kristjan at ccpgames.com>:

in shamodule.c, the digest() method just creates a simple bytes string of the digest.  The digest is stored as an array of 32 bit integers in the native representation.  Therefore, the digest will be different on big-  and little-endian machines.

The specification (http://en.wikipedia.org/wiki/SHA-1) suggest that the digest should actually be big endian, so the standard implementation on most home machines is actually wrong

Actually, looking at the code, hexdigest() has the same problem!

----------
components: Extension Modules
messages: 121268
nosy: krisvale
priority: normal
severity: normal
status: open
title: _sha.sha().digest() method is endian-sensitive. and hexdigest()
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10430>
_______________________________________


More information about the Python-bugs-list mailing list