python glibc crypt() function

Дамјан Георгиевски gdamjan at gmail.com
Tue Apr 20 23:26:03 CEST 2010


>> Hello i have to do this :
>> glibc crypt() function, using salt $1$abcdefgh$
>> 
>> cryptPw = crypt(plainPw, "$1$abcdefgh$")
>> 
>> I can do it in python, with package i need?
>> Thanks
> 
>>>> import ctypes
>>>> lib = ctypes.CDLL("libcrypt.so.1")
>>>> crypt = lib.crypt
>>>> crypt.restype = ctypes.c_char_p
>>>> crypt("password", "$1$abcdefgh$")
> '$1$abcdefgh$G//4keteveJp0qb8z2DxG/'
> 
> Is that what it's supposed to return?

seeing this I thought about using ctypes for AES (or similar) crypto 
function. A bit of google searching I've come to 
http://code.google.com/p/ctypescrypto/

just FYI


-- 
дамјан ((( http://damjan.softver.org.mk/ )))

... knowledge is exactly like power - something 
to be distributed as widely as humanly possible,
for the betterment of all. -- jd




More information about the Python-list mailing list