관리-도구
편집 파일: hashlib.cpython-33.pyc
� ��f1 c @ s( d Z d Z e e � Z e e � Z e d Z d d � Z d d � Z d d d d � Z d d d d � Z y. d d l Z e Z e Z e j e j � Z Wn e k r� e Z e Z Yn XxV e D]N Z y e e � e � e <Wq� e k r d d l Z e j d e � Yq� Xq� W[ [ [ [ [ [ d S( u9 hashlib module - A common interface to many hash functions. new(name, data=b'') - returns a new hash object implementing the given hash function; initializing the hash using the given binary data. Named constructor functions are also available, these are faster than using new(name): md5(), sha1(), sha224(), sha256(), sha384(), and sha512() More algorithms may be available on your platform but the above are guaranteed to exist. See the algorithms_guaranteed and algorithms_available attributes to find out what algorithm names can be passed to new(). NOTE: If you want the adler32 or crc32 hash functions they are available in the zlib module. Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. If the underlying implementation supports "FIPS mode", and this is enabled, it may restrict the available hashes to only those that are compliant with FIPS regulations. For example, it may deny the use of MD5, on the grounds that this is not secure for uses such as authentication, system integrity checking, or digital signatures. If you need to use such a hash for non-security purposes (such as indexing into a data structure for speed), you can override the keyword argument "usedforsecurity" from True to False to signify that your code is not relying on the hash for security purposes, and this will allow the hash to be usable even in FIPS mode. Hash objects have these methods: - update(arg): Update the hash object with the bytes in arg. Repeated calls are equivalent to a single call with the concatenation of all the arguments. - digest(): Return the digest of the bytes passed to the update() method so far. - hexdigest(): Like digest() except the digest is returned as a unicode object of double length, containing only hexadecimal digits. - copy(): Return a copy (clone) of the hash object. This can be used to efficiently compute the digests of strings that share a common initial substring. For example, to obtain the digest of the string 'Nobody inspects the spammish repetition': >>> import hashlib >>> m = hashlib.md5() >>> m.update(b"Nobody inspects") >>> m.update(b" the spammish repetition") >>> m.digest() b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' More condensed: >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' u md5u sha1u sha224u sha256u sha384u sha512u newu algorithms_guaranteedu algorithms_availablec C s y� | d k r"