This is because Linux glibc handles passwords differently - the Linux salt of the password matches the type of hash that it generates. OSX crypt () is simple DES encryption (which is awful).
glibc supports many hash algorithms (MD5, Blowfish, SHA-256, etc.).
If we look at the crypt.3 manpage, we can see:
If salt is a character string starting with the characters "$id$" followed by a string terminated by "$": $id$salt$encrypted then instead of using the DES machine, id identifies the encryption method used and this then determines how the rest of the password string is interpreted. The following values of id are supported: ID | Method
So, considering that the information .. allows you to take your password from the second example, using Linux crypt
$1$VFvON1xK$SboCDZGBieKF1ns2GBfY50' ('test', encrypted with salt=VFvON1xK) 1 == MD5 VFvON1xK == Salt SboCDZGBieKF1ns2GBfY50 == Hashed password
Fortunately for you there is a cross-platform solution for this, passlib.hash.md5_crypt .
Here's how you use it:
from passlib.hash import md5_crypt hash = md5_crypt.encrypt("test",salt="VFvON1xK") print hash
When run on Linux or OSX, a hash with friendly access is generated:
$1$VFvON1xK$SboCDZGBieKF1ns2GBfY50
Identical to the original created on a Linux machine.
synthesizerpatel
source share