#17481 closed Bug (fixed)
leading zeros are missing from result of pbkdf2
| Reported by: | bhuztez | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | 1.4-alpha-1 |
| Severity: | Release blocker | Keywords: | |
| Cc: | bhuztez@… | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Here is an example.
>>> import hashlib >>> from django.utils import crypto >>> from M2Crypto import EVP >>> EVP.pbkdf2(chr(186), 'salt', 1, 20) '\x00S\xd3\xb9\x1a\x7f\x1eT\xef\xfe\xbdmhw\x1e\x8an\x0b,[' >>> crypto.pbkdf2(chr(186), 'salt', 1, 20, digest=hashlib.sha1) 'S\xd3\xb9\x1a\x7f\x1eT\xef\xfe\xbdmhw\x1e\x8an\x0b,[' >>>
Attachments (2)
Change History (8)
comment:1 by , 14 years ago
| Cc: | added |
|---|
comment:2 by , 14 years ago
| Component: | Uncategorized → Core (Other) |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
by , 14 years ago
| Attachment: | pbkdf2.diff added |
|---|
comment:3 by , 14 years ago
| Has patch: | set |
|---|---|
| Needs tests: | set |
comment:4 by , 14 years ago
| Needs tests: | unset |
|---|
comment:5 by , 14 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
In [17418]:
(The changeset message doesn't reference this ticket)
Note:
See TracTickets
for help on using tickets.
Confirmed with this totally over-engineered snippet:
>>> import difflib >>> import hashlib >>> from django.utils import crypto >>> from M2Crypto import EVP >>> for i in range(255): ... expected = repr(EVP.pbkdf2(chr(i), 'salt', 1, 20)) ... actual = repr(crypto.pbkdf2(chr(i), 'salt', 1, 20, digest=hashlib.sha1)) ... if expected != actual: ... for l in difflib.unified_diff([expected], [actual], str(i), str(i)): ... print l.rstrip("\n") ... --- 186 +++ 186 @@ -1 +1 @@ -'\x00S\xd3\xb9\x1a\x7f\x1eT\xef\xfe\xbdmhw\x1e\x8an\x0b,[' +'S\xd3\xb9\x1a\x7f\x1eT\xef\xfe\xbdmhw\x1e\x8an\x0b,[' --- 241 +++ 241 @@ -1 +1 @@ -'\x00\xf6(/Vb\x82\xd7\xb7OJ\xfe\x8e\xf6N\x95\x12\xc5\x9b\x9f' +'\xf6(/Vb\x82\xd7\xb7OJ\xfe\x8e\xf6N\x95\x12\xc5\x9b\x9f'