10 Jun
2001
10 Jun
'01
11:57 a.m.
"Daniel Fairs" <daniel.fairs@spiderplant.net> writes:
What's the best way to generate a secure unique ID in Zope? I've tried generating a random integer then md5'ing it, but trying to do an md5.new()
I am using an external Python method for that: # Token.py # generate a token for user accounts # the token is built from a secret key and the users # first and last name and his email address # 2001-04-14 Frank Tegtmeyer import sha, binascii def GetToken(initstring): s=sha.new() s.update("put your secret string here") s.update(initstring) return binascii.b2a_base64(s.digest())[:16] if __name__=='__main__': print GetToken('abcdefg') Regards, Frank