python glibc crypt() function

luca72 lucaberto at libero.it
Wed Apr 21 02:29:57 EDT 2010


On 20 Apr, 19:38, Peter Otten <__pete... at web.de> wrote:
> luca72 wrote:
> > Hello i have to do this :
> > glibc crypt() function, using salt $1$abcdefgh$
>
> > cryptPw = crypt(plainPw, "$1$abcdefgh$")
Thanks
The result is correct i obtain the same with ctypes and crypt module,
so i think that is better to use the crypt module is correct?

Luca

>
> > 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?
>
> Peter




More information about the Python-list mailing list