Which sha to use?

S. Alan Ezust ezust at users.sourceforge.net
Sat May 22 18:55:00 CEST 2004


Hi, I'm new here.

Which SHA to use? slappasswd claims to use SHA digests, but it's not the same 
as what the python sha built-in uses. Does the LDAP python library have its 
own sha interface that's compatible with slappasswd?
:
>>> import sha
>>> x = sha.new("foobar")
>>> x.digest()
'\x88C\xd7\xf9$\x16!\x1d\xe9\xeb\xb9c\xffL\xe2\x81%\x93(x'
>>> x.hexdigest()
'8843d7f92416211de9ebb963ff4ce28125932878'

$ slappasswd
New password: foobar
{SSHA}ssib43Zm62dDYjKVLYg/IMXJMBJPMYDG

Why are these different anyway? Should I be using the sha built-in 
differently? 

question #2: Is there a simple example of how to add the first 
user/sha-password/e-mail into a brand-new LDAP repository and then query it 
to get the user back?



-- 
S. Alan Ezust
Ottawa, Ontario, Canada
http://cartan.cas.suffolk.edu/~sae





More information about the python-ldap mailing list