{
    "mode": "pydoc",
    "parameter": "hashlib",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/hashlib/json",
    "generated": "2026-06-02T13:19:58Z",
    "sections": {
        "NAME": {
            "content": "hashlib - hashlib module - A common interface to many hash functions.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/hashlib.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "",
            "subsections": [
                {
                    "name": "new",
                    "content": "given hash function; initializing the hash\nusing the given binary data.\n\nNamed constructor functions are also available, these are faster\nthan using new(name):\n"
                },
                {
                    "name": "md5",
                    "content": "sha3224, sha3256, sha3384, sha3512, shake128, and shake256.\n\nMore algorithms may be available on your platform but the above are guaranteed\nto exist.  See the algorithmsguaranteed and algorithmsavailable attributes\nto find out what algorithm names can be passed to new().\n\nNOTE: If you want the adler32 or crc32 hash functions they are available in\nthe zlib module.\n\nChoose your hash function wisely.  Some have known collision weaknesses.\nsha384 and sha512 will be slow on 32 bit platforms.\n\nHash objects have these methods:\n- update(data): Update the hash object with the bytes in data. Repeated calls\nare equivalent to a single call with the concatenation of all\nthe arguments.\n- digest():     Return the digest of the bytes passed to the update() method\nso far as a bytes object.\n- hexdigest():  Like digest() except the digest is returned as a string\nof double length, containing only hexadecimal digits.\n- copy():       Return a copy (clone) of the hash object. This can be used to\nefficiently compute the digests of datas that share a common\ninitial substring.\n\nFor example, to obtain the digest of the byte string 'Nobody inspects the\nspammish repetition':\n\n>>> import hashlib\n>>> m = hashlib.md5()\n>>> m.update(b\"Nobody inspects\")\n>>> m.update(b\" the spammish repetition\")\n>>> m.digest()\nb'\\xbbd\\x9c\\x83\\xdd\\x1e\\xa5\\xc9\\xd9\\xde\\xc9\\xa1\\x8d\\xf0\\xff\\xe9'\n\nMore condensed:\n\n>>> hashlib.sha224(b\"Nobody inspects the spammish repetition\").hexdigest()\n'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'\n"
                }
            ]
        },
        "CLASSES": {
            "content": "builtins.object\nblake2.blake2b\nblake2.blake2s\n",
            "subsections": [
                {
                    "name": "class blake2b",
                    "content": "|  blake2b(data=b'', /, *, digestsize=64, key=b'', salt=b'', person=b'', fanout=1, depth=1, leafsize=0, nodeoffset=0, nodedepth=0, innersize=0, lastnode=False, usedforsecurity=True)\n|\n|  Return a new BLAKE2b hash object.\n|\n|  Methods defined here:\n|\n|  copy(self, /)\n|      Return a copy of the hash object.\n|\n|  digest(self, /)\n|      Return the digest value as a bytes object.\n|\n|  hexdigest(self, /)\n|      Return the digest value as a string of hexadecimal digits.\n|\n|  update(self, data, /)\n|      Update this hash object's state with the provided bytes-like object.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  blocksize\n|\n|  digestsize\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  MAXDIGESTSIZE = 64\n|\n|  MAXKEYSIZE = 64\n|\n|  PERSONSIZE = 16\n|\n|  SALTSIZE = 16\n"
                },
                {
                    "name": "class blake2s",
                    "content": "|  blake2s(data=b'', /, *, digestsize=32, key=b'', salt=b'', person=b'', fanout=1, depth=1, leafsize=0, nodeoffset=0, nodedepth=0, innersize=0, lastnode=False, usedforsecurity=True)\n|\n|  Return a new BLAKE2s hash object.\n|\n|  Methods defined here:\n|\n|  copy(self, /)\n|      Return a copy of the hash object.\n|\n|  digest(self, /)\n|      Return the digest value as a bytes object.\n|\n|  hexdigest(self, /)\n|      Return the digest value as a string of hexadecimal digits.\n|\n|  update(self, data, /)\n|      Update this hash object's state with the provided bytes-like object.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  blocksize\n|\n|  digestsize\n|\n|  name\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  MAXDIGESTSIZE = 32\n|\n|  MAXKEYSIZE = 32\n|\n|  PERSONSIZE = 8\n|\n|  SALTSIZE = 8\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "md5 = opensslmd5(string=b'', *, usedforsecurity=True)\nReturns a md5 hash object; optionally initialized with a string\n\nnew = hashnew(name, data=b'', kwargs)\nnew(name, data=b'') - Return a new hashing object using the named algorithm;\noptionally initialized with data (which must be a bytes-like object).\n",
            "subsections": [
                {
                    "name": "pbkdf2_hmac",
                    "content": "Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as pseudorandom function.\n\nsha1 = opensslsha1(string=b'', *, usedforsecurity=True)\nReturns a sha1 hash object; optionally initialized with a string\n\nsha224 = opensslsha224(string=b'', *, usedforsecurity=True)\nReturns a sha224 hash object; optionally initialized with a string\n\nsha256 = opensslsha256(string=b'', *, usedforsecurity=True)\nReturns a sha256 hash object; optionally initialized with a string\n\nsha384 = opensslsha384(string=b'', *, usedforsecurity=True)\nReturns a sha384 hash object; optionally initialized with a string\n\nsha3224 = opensslsha3224(string=b'', *, usedforsecurity=True)\nReturns a sha3-224 hash object; optionally initialized with a string\n\nsha3256 = opensslsha3256(string=b'', *, usedforsecurity=True)\nReturns a sha3-256 hash object; optionally initialized with a string\n\nsha3384 = opensslsha3384(string=b'', *, usedforsecurity=True)\nReturns a sha3-384 hash object; optionally initialized with a string\n\nsha3512 = opensslsha3512(string=b'', *, usedforsecurity=True)\nReturns a sha3-512 hash object; optionally initialized with a string\n\nsha512 = opensslsha512(string=b'', *, usedforsecurity=True)\nReturns a sha512 hash object; optionally initialized with a string\n\nshake128 = opensslshake128(string=b'', *, usedforsecurity=True)\nReturns a shake-128 variable hash object; optionally initialized with a string\n\nshake256 = opensslshake256(string=b'', *, usedforsecurity=True)\nReturns a shake-256 variable hash object; optionally initialized with a string\n"
                }
            ]
        },
        "DATA": {
            "content": "all = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'bla...\nalgorithmsavailable = {'blake2b', 'blake2s', 'md5', 'md5-sha1', 'sha1...\nalgorithmsguaranteed = {'blake2b', 'blake2s', 'md5', 'sha1', 'sha224'...\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/hashlib.py\n\n",
            "subsections": []
        }
    },
    "summary": "hashlib - hashlib module - A common interface to many hash functions.",
    "flags": [],
    "examples": [],
    "see_also": []
}