hashlib in one line

Thomas Guettler hv at tbz-pariv.de
Mon Nov 29 09:14:03 EST 2010


Thank you, I was blind:

See "condensed":
http://docs.python.org/library/hashlib.html


Stefan Sonnenberg-Carstens wrote:
> Am 29.11.2010 14:50, schrieb Thomas Guettler:
>> Hi,
>>
>> I think it would be nice if you could use the hashlib in one line:
>>
>> hashlib.sha256().update('abc').hexdigest()
>>
>> Unfortunately update() returns None.
>>
>> Is there a way to convert a string to the hexdigest of sha256 in one
>> line?
>>
>>    Thomas
>>
>>
> Like so ?
> 
>>>> hashlib.sha256('abc').hexdigest()
> 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de



More information about the Python-list mailing list