hyb
2026-01-30 7657e1b2fa251a2ea372710ad75cb395a3c0e374
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Ë
ž¬`i:*ãó†—ddlmZddlmZddlmZddlmZmZddl    m
Z
m Z m Z ddl mZdZd d„ZGd    „d
e«Z        d d „Zy)é)Ú    unhexlify)ÚBLAKE2s)Ústrxor)Ú long_to_bytesÚ bytes_to_long)ÚbordÚtobytesÚ _copy_bytes)Úget_random_bytesNcóh—t|«dz|z }t|t|««t|« dS)Né)rrÚlen)ÚbsÚxor_lsbÚnums   õcH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\Crypto/Hash/CMAC.pyÚ _shift_bytesr$s4€Ü ˜Ó  Ñ ! WÑ
,€CÜ ˜œc "›gÓ &¬¨B« x yÐ 1Ð1ócóD—eZdZdZdZd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z y) ÚCMACz¼A CMAC hash object.
    Do not instantiate directly. Use the :func:`new` function.
 
    :ivar digest_size: the size in bytes of the resulting MAC tag
    :vartype digest_size: integer
    Ncój—||_tdd|«|_||_||_|j
x|_}d|_||_|dk(r
d}d|_    n|dk(r
d}d|_    ntd|z«‚d|z}    |j||jfi|j¤Ž|_ |jj|    «}
t|
d    «d
zrt!|
|«|_nt!|
«|_t|j"d    «d
zrt!|j"|«|_nt!|j"«|_|j||j&|    fi|j¤Ž|_t+|«|_d    |_|    |_d|_d    |_|r|j7|«yy) Nééiéé‡l€zACMAC requires a cipher with a block size of 8 or 16 bytes, not %dóré€)Ú digest_sizer
Ú_keyÚ_factoryÚ_cipher_paramsÚ
block_sizeÚ _block_sizeÚ_mac_tagÚ_update_after_digestÚ    _max_sizeÚ    TypeErrorÚnewÚMODE_ECBÚ_ecbÚencryptrrÚ_k1Ú_k2ÚMODE_CBCÚ_cbcÚ    bytearrayÚ_cacheÚ_cache_nÚ_last_ctÚ_last_ptÚ
_data_sizeÚupdate) ÚselfÚkeyÚmsgÚ    ciphermodÚ cipher_paramsÚmac_lenÚupdate_after_digestrÚconst_RbÚ
zero_blockÚLs            rÚ__init__z CMAC.__init__3s°€ð#ˆÔä  d¨CÓ0ˆŒ    Ø!ˆŒ Ø+ˆÔØ )× 4Ñ 4Ð4ˆÔ˜2؈Œ Ø$7ˆÔ!𠐊7؈HØ*ˆDNØ 2ŠX؈HØ+ˆDNäð8Ø:<ñ=ó>ð >ð˜r‘\ˆ
Ø!I—M‘M #Ø"+×"4Ñ"4ñ9à$(×$7Ñ$7ñ9ˆŒ    ð I‰I× Ñ ˜jÓ )ˆÜ !‘‹:˜Ò Ü# A xÓ0ˆDHä# A“ˆDŒHÜ —‘˜‘ Ó ˜tÒ #Ü# D§H¡H¨hÓ7ˆDHä# D§H¡HÓ-ˆDŒHð"I—M‘M #Ø"+×"4Ñ"4Ø",ñ9ð%)×$7Ñ$7ñ9ˆŒ    ô   “mˆŒ ؈Œ ð#ˆŒ ðˆŒ ðˆŒá Ø K‰K˜Õ ð rcó¨—|j|js td«‚|xjt    |«z c_|j
}|j dkDr¡t||j z
t    |««}|d||j|j |j |z|xj |z c_|j |kr|St|«|d}|j|j«d|_t    |«|z}|dkDr)|j|d| «|| d|jd|n|j|«||_|S)zŒAuthenticate the next chunk of message.
 
        Args:
            data (byte string/byte array/memoryview): The next chunk of data
        Nz4update() cannot be called after digest() or verify()r) r$r%r'r5rr#r2Úminr1Ú
memoryviewÚ_update)r7r9rÚfillerÚremains     rr6z CMAC.updateos%€ð =‰=Ð $¨T×-FÒ-FÜÐRÓSÐ Sà Šœ3˜s›8Ñ#Ø × Ñ ˆà =‰=˜1Ò Ü˜˜dŸm™mÑ+¬S°«XÓ6ˆFØ>AÀ'À6¸lˆDK‰K˜Ÿ ™  d§m¡m°FÑ&:Ð ;Ø MŠM˜VÑ #Mà}‰}˜rÒ!ؐ ä˜S“/ & 'Ð*ˆCØ L‰L˜Ÿ™Ô %؈DŒMäS“˜B‘ˆØ AŠ:Ø L‰L˜˜X˜v˜g˜Ô 'Ø#&¨ w x =ˆDK‰K˜˜Ñ  à L‰L˜Ô ؈Œ ؈ rcó —|j}t|«|zdk(sJ‚t|«dk(ry|jj|«}t|«|k(r |j}n
|| dz| }|| d|_t ||| d«|_y)z,Update a block aligned to the block boundaryrNé)r#rr/r+r3rr4)r7Ú
data_blockrÚctÚ second_lasts     rrEz CMAC._update‘s—€ð× Ñ ˆÜ:‹ Ñ# qÒ(Ð(Ð(ä ˆz‹?˜aÒ Ø à Y‰Y× Ñ ˜zÓ *ˆÜ ˆz‹?˜bÒ  ØŸ-™-‰Kà˜b˜S ™U B 3˜-ˆKؘB˜3˜4˜ˆŒ ܘ{¨J¸°s°tÐ,<Ó=ˆ rcój—|jt«}|jj«|_|jj
|j |jj|jfi|j¤Ž|_
|jdd|_ |jdd|_|S)a+Return a copy ("clone") of the CMAC object.
 
        The copy will have the same internal state as the original CMAC
        object.
        This can be used to efficiently compute the MAC tag of byte
        strings that share a common initial substring.
 
        :return: An :class:`CMAC`
        N) Ú__new__rÚ__dict__Úcopyr r(rr.r3r!r/r1)r7Úobjs  rrPz    CMAC.copy¢sŽ€ðl‰lœ4Ó ˆØ—}‘}×)Ñ)Ó+ˆŒ Ø$4—=‘=×$Ñ$ T§Y¡YØ%)§]¡]×%;Ñ%;Ø%)§]¡]ñ<ð(,×':Ñ':ñ<ˆŒð—[‘[¡^ˆŒ
Ø—}‘}¡QÐ'ˆŒ ؈
rcóV—|j}|j|js |jS|j|jkDr t d«‚|j dk(r0|jdkDr!t|j|j«}n^|jdd}dd||j z
dz
zz||j dtt|j|«|j«}|jj|«d|j|_|jS)zóReturn the **binary** (non-printable) MAC tag of the message
        that has been authenticated so far.
 
        :return: The MAC tag, computed over the data processed so far.
                 Binary form.
        :rtype: byte string
        NzMAC is unsafe for this messageró€rr )r#r$r%r5r&Ú
ValueErrorr2rr4r,r1r3r-r*r+r)r7rÚptÚpartials    rÚdigestz CMAC.digest·só€ð× Ñ ˆà =‰=Ð $¨T×-FÒ-FØ—=‘=Ð  à ?‰?˜TŸ^™^Ò +ÜÐ=Ó>Ð >à =‰=˜AÒ  $§/¡/°AÒ"5䘟 ™  t§x¡xÓ0‰Bð—k‘k¡!nˆGØ&-°¸2ÀÇ Á Ñ;MÐPQÑ;QÑ0RÑ&RˆGD—M‘MNÐ #Üœ˜tŸ}™}¨gÓ6¸¿¹ÓAˆBàŸ    ™    ×)Ñ)¨"Ó-Ð.?¨t×/?Ñ/?Ð@ˆŒ à}‰}Ðrc    ó—djt|j««Dcgc]}dt|«z‘Œc}«Scc}w)zÓReturn the **printable** MAC tag of the message authenticated so far.
 
        :return: The MAC tag, computed over the data processed so far.
                 Hexadecimal encoded.
        :rtype: string
        Úz%02x)ÚjoinÚtuplerWr)r7Úxs  rÚ    hexdigestzCMAC.hexdigestÕsD€ðw‰wÜ!& t§{¡{£}Ó!5ö7Øð¤ a£Ó(ò7ó8ð    8ùò7s§Acóî—td«}tjd||¬«}tjd||j«¬«}|j«|j«k7r t    d«‚y)agVerify that a given **binary** MAC (computed by another party)
        is valid.
 
        Args:
          mac_tag (byte string/byte array/memoryview): the expected MAC of the message.
 
        Raises:
            ValueError: if the MAC does not match. It means that the message
                has been tampered with or that the MAC key is incorrect.
        ré )Ú digest_bitsr8ÚdatazMAC check failedN)r rr(rWrT)r7Úmac_tagÚsecretÚmac1Úmac2s     rÚverifyz CMAC.verifyàs]€ô" "Ó%ˆä{‰{ s°¸WÔEˆÜ{‰{ s°¸T¿[¹[»]ÔKˆà ;‰;‹=˜DŸK™K›MÒ )ÜÐ/Ó0Ð 0ð *rcóJ—|jtt|«««y)alVerify that a given **printable** MAC (computed by another party)
        is valid.
 
        Args:
          hex_mac_tag (string): the expected MAC of the message, as a hexadecimal string.
 
        Raises:
            ValueError: if the MAC does not match. It means that the message
                has been tampered with or that the MAC key is incorrect.
        N)rfrr    )r7Ú hex_mac_tags  rÚ    hexverifyzCMAC.hexverifyôs€ð      ‰ ”Iœg kÓ2Ó3Õ4r) Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrAr6rErPrWr]rfri©rrrr)s8„ñð€Kò:òx òD>ò"ò*ò<    8ò1ó( 5rrcóä—|€ td«‚|€in
t|«}|€ |j}|dkr td«‚||jkDrtd|jz«‚t    ||||||«S)a Create a new MAC object.
 
    Args:
        key (byte string/byte array/memoryview):
            key for the CMAC object.
            The key must be valid for the underlying cipher algorithm.
            For instance, it must be 16 bytes long for AES-128.
        ciphermod (module):
            A cipher module from :mod:`Crypto.Cipher`.
            The cipher's block size has to be 128 bits,
            like :mod:`Crypto.Cipher.AES`, to reduce the probability
            of collisions.
        msg (byte string/byte array/memoryview):
            Optional. The very first chunk of the message to authenticate.
            It is equivalent to an early call to `CMAC.update`. Optional.
        cipher_params (dict):
            Optional. A set of parameters to use when instantiating a cipher
            object.
        mac_len (integer):
            Length of the MAC, in bytes.
            It must be at least 4 bytes long.
            The default (and recommended) length matches the size of a cipher block.
        update_after_digest (boolean):
            Optional. By default, a hash object cannot be updated anymore after
            the digest is computed. When this flag is ``True``, such check
            is no longer enforced.
    Returns:
        A :class:`CMAC` object
    z%ciphermod must be specified (try AES)éz,MAC tag length must be at least 4 bytes longz>MAC tag length cannot be larger than a cipher block (%d) bytes)r'Údictr"rTr)r8r9r:r;r<r=s      rr(r(s‹€ð@ÐÜÐ?Ó@Ð@à'Ð/‘B´T¸-Ó5H€Mà€Ø×&Ñ&ˆà‚{ÜÐGÓHÐHà×%Ñ%Ò%ÜÐYÐ\e×\pÑ\pÑpÓqÐqä S˜) ]°GØ#ó %ð%r)r)NNNNF)ÚbinasciirÚ Crypto.HashrÚCrypto.Util.strxorrÚCrypto.Util.numberrrÚCrypto.Util.py3compatrr    r
Ú Crypto.Randomr rrÚobjectrr(rnrrú<module>rysFðõ.åÝ%ß;ß<Ñ<Ý*ð€ ó2ô
W5ˆ6ôW5ðtDHØ!ô/%r