This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年09月17日 14:11 by lunokhod, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg227002 - (view) | Author: Mark Wieczorek (lunokhod) | Date: 2014年09月17日 14:11 | |
Hi,
I just wanted to let you know of a bug that is related to the function "crypt" in osx (10.9.4). I have tried the default osx version of python (2.75), the brew version (2.7.8), and the macports version (2.7.7).
In short, the command
python -c 'import crypt; print crypt.crypt("test12345", "6ドル$salt")'
produces the output : 6ドルn8sgZJBMh4U
The correct output should be
6ドル$salt$omHbK1V1Alwa0VKXqLaW38vdS1uUhfx8GTj7XXCJcNUJxABwmYe8Vhpyt2tnnaAFC6UTI7PNk9sTtSGWGnYop.
I have no idea what the problem is.
|
|||
| msg227003 - (view) | Author: Geoffrey Spear (geoffreyspear) * | Date: 2014年09月17日 14:23 | |
The same behavior exists in Python 3, however, I'm not sure it's a bug. The documentation says "The characters in salt must be in the set [./a-zA-Z0-9]." Presumably the behavior when there is a $ in the salt is undefined by Python, and different on different platforms. |
|||
| msg227004 - (view) | Author: Mark Wieczorek (lunokhod) | Date: 2014年09月17日 14:25 | |
It actually doesn't even matter what you use for salt. If you change "salt", you get the same hash. That is bug #2 ! |
|||
| msg227005 - (view) | Author: Geoffrey Spear (geoffreyspear) * | Date: 2014年09月17日 14:41 | |
This is actually the expected behavior of crypt(3) on OS X. It doesn't support the $id$ modular format, and if the salt does not begin with an underscore only the first 2 bytes are used (presumably in your "bug #2" you're changing parts of the salt beyond the first 2 bytes.) Python's behavior differing based on the underlying C library on the system is documented; this is neither a bug in Python or in OS X crypt (although it could be argued that OS X crypt is kind of useless and insecure...) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:08 | admin | set | github: 66622 |
| 2014年09月17日 15:01:07 | r.david.murray | set | status: open -> closed nosy: + r.david.murray resolution: not a bug stage: resolved |
| 2014年09月17日 14:41:01 | geoffreyspear | set | messages: + msg227005 |
| 2014年09月17日 14:25:56 | lunokhod | set | messages: + msg227004 |
| 2014年09月17日 14:23:10 | geoffreyspear | set | nosy:
+ geoffreyspear messages: + msg227003 |
| 2014年09月17日 14:11:23 | lunokhod | create | |