4

I'm using an OSX 10.9 (last version) with the last Xcode. When I execute the following command:

python -c 'import crypt; print crypt.crypt("test", "$6$random_salt")'

I get this as an answer:

$6asQOJRqB1i2

but if I execute the same in a debian machine (same version of python) I get the following:

$6$random_salt$sJ0ZOQCUESBs9rYCOLCqGV93zg1cSDgZV/FF6ZBzpnvNUVODwaaVoPV2SiL0ur7Sexh02hMmXdSBOa216GWoh.

What is wrong with my machine?

Abraham
  • 531
  • 5
  • 13

2 Answers2

3

The implementation of crypt() on Mac OS X does not support most of the "advanced" modes supported by the Linux glibc crypt(). It only supports "traditional crypt()", which is what you're getting here, and an "extended crypt()" mode which is not compatible with the Linux implementation either.

If you need to create strong password hashes portably across Linux and Mac OS X, you'll need to use something other than crypt().

2

The problem seems to be in the crypt implementation as @dukswuff comments. If anyone ends up in the same problem, there is a python alternative solution you can read here: https://stackoverflow.com/a/17992126/2208811

Community
  • 1
  • 1
Abraham
  • 531
  • 5
  • 13