#-*- encoding:gb2312 -*- import hashlib a = "a test string" print 'md5 = %s' % (hashlib.md5(a).hexdigest(),) print 'sha1 = %s' % (hashlib.sha1(a).hexdigest(),) print 'sha224 = %s' % (hashlib.sha224(a).hexdigest(),) print 'sha256 = %s' % (hashlib.sha256(a).hexdigest(),) print 'sha384 = %s' % (hashlib.sha384(a).hexdigest(),) print 'sha512 = %s' % (hashlib.sha512(a).hexdigest(),)
md5 = b1a4cf30d3f4095f0a7d2a6676bcae77 sha1 = 2da75da5c85478df42df0f917700241ed282f599 sha224 = fb29c0daf4a995d2caad4cc5150a6977f871ac34c1c9c97d740d90d0 sha256 = b830543dc5d1466110538736d35c37cc61d32076a69de65c42913dfbb1961f46 sha384 = 1b7c9d326961a90d6fe5e168b7339852a6238af953e5cad5501d140167bdfe8ebd82d7df5f7915ebad3e2f89d977357f sha512 = fd308aadbf52384412c4ba3e2dfe3551e0faa2e7455898dae04fda4f238569e3889c56cbd4d120cf69f81a5f06456f327c19100eaed2e590888342f1ce3e0261