hyb
2026-01-30 44480e71b27aa9d4cb8441f50c873f1b110e9691
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Ë
ž¬`iO.ãó¨—ddlmZddlmZddlmZddlmZmZddl    m
Z
ddl m Z ddl mZmZddlmZd    „Zed
d d ¬ «ZGd„de«Zd„ZdZy)é)Ú    unhexlify)ÚChaCha20)Ú
_HChaCha20)ÚPoly1305ÚBLAKE2s)Úget_random_bytes)Ú long_to_bytes)Ú _copy_bytesÚbord)Ú    is_bufferc ó—tdd|«S)NÚEnum©)Útype)Úenumss õrH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\Crypto/Cipher/ChaCha20_Poly1305.pyÚ_enumr,s€Ü ˜˜EÓ "Ð"óééé)ÚPROCESSING_AUTH_DATAÚPROCESSING_CIPHERTEXTÚPROCESSING_DONEcó\—eZdZdZd„Zd„Zd„Zdd„Zdd„Zd„Z    d    „Z
d
„Z d „Z d „Z d „Zd„Zy)ÚChaCha20Poly1305CipherzÐChaCha20-Poly1305 and XChaCha20-Poly1305 cipher object.
    Do not create it directly. Use :py:func:`new` instead.
 
    :var nonce: The nonce with length 8, 12 or 24 bytes
    :vartype nonce: byte string
    có—d|_tj||t¬«|_tj||¬«|_|j
j d«d|_d|_d|_    tj|_ y)z`Initialize a ChaCha20-Poly1305 AEAD cipher object
 
        See also `new()` at the module level.)ÚupdateÚencryptÚdecryptÚdigestÚverify)ÚkeyÚnonceÚcipher)r#r$é@rN) Ú_nextrÚnewrÚ_authenticatorÚ_cipherÚseekÚ_len_aadÚ_len_ctÚ_mac_tagÚ _CipherStatusrÚ_status)Úselfr#r$s   rÚ__init__zChaCha20Poly1305Cipher.__init__=sh€ð
 ˆŒ
ô'Ÿl™l¨s¸%ÌÔQˆÔä—|‘|¨°5Ô9ˆŒ Ø  ‰ ×ј"ÔàˆŒ ؈Œ ؈Œ Ü$×9Ñ9ˆ rcó¨—d|jvr td«‚|xjt|«z c_|jj |«y)a‰Protect the associated data.
 
        Associated data (also known as *additional authenticated data* - AAD)
        is the piece of the message that must stay in the clear, while
        still allowing the receiver to verify its integrity.
        An example is packet headers.
 
        The associated data (possibly split into multiple segments) is
        fed into :meth:`update` before any call to :meth:`decrypt` or :meth:`encrypt`.
        If there is no associated data, :meth:`update` is not called.
 
        :param bytes/bytearray/memoryview assoc_data:
            A piece of associated data. There are no restrictions on its size.
        rz update() method cannot be calledN)r'Ú    TypeErrorr,Úlenr)r)r1Údatas  rrzChaCha20Poly1305Cipher.updateOsB€ð  ˜4Ÿ:™:Ñ %ÜÐ>Ó?Ð ?à  Š œ˜T›Ñ" Ø ×Ñ×"Ñ" 4Õ(rcóæ—|jtjk(sJ‚|jdzr.|jj dd|jdzz
z«tj |_y)Néóé)r0r/rr,r)rr©r1s rÚ_pad_aadzChaCha20Poly1305Cipher._pad_aadesZ€à|‰|œ}×AÑAÒAÐBÐAØ =‰=˜4Ò Ø × Ñ × &Ñ & w°"¸¿ ¹ ÈÑ8LÑ2MÑ'NÔ OÜ$×:Ñ:ˆ rNcóŠ—d|jvr td«‚|jtjk(r|j «d|_|j j||¬«}|xjt|«z c_|€|jj|«|S|jj|«|S)a«Encrypt a piece of data.
 
        Args:
          plaintext(bytes/bytearray/memoryview): The data to encrypt, of any size.
        Keyword Args:
          output(bytes/bytearray/memoryview): The location where the ciphertext
            is written to. If ``None``, the ciphertext is returned.
        Returns:
          If ``output`` is ``None``, the ciphertext is returned as ``bytes``.
          Otherwise, ``None``.
        rz!encrypt() method cannot be called©rr!©Úoutput) r'r4r0r/rr<r*rr-r5r)r)r1Ú    plaintextr@Úresults    rrzChaCha20Poly1305Cipher.encryptls¤€ð ˜DŸJ™JÑ &ÜÐ?Ó@Ð @à <‰<œ=×=Ñ=Ò =Ø M‰MŒOà*ˆŒ
à—‘×%Ñ% i¸Ð%Ó?ˆØ  Š œ˜I›Ñ& Ø ˆ>Ø × Ñ × &Ñ & vÔ .ðˆ ð × Ñ × &Ñ & vÔ .؈ rcóH—d|jvr td«‚|jtjk(r|j «d|_|xj t|«z c_|jj|«|jj||¬«S)a©Decrypt a piece of data.
 
        Args:
          ciphertext(bytes/bytearray/memoryview): The data to decrypt, of any size.
        Keyword Args:
          output(bytes/bytearray/memoryview): The location where the plaintext
            is written to. If ``None``, the plaintext is returned.
        Returns:
          If ``output`` is ``None``, the plaintext is returned as ``bytes``.
          Otherwise, ``None``.
        r z!decrypt() method cannot be called©r r"r?) r'r4r0r/rr<r-r5r)rr*r )r1Ú
ciphertextr@s   rr zChaCha20Poly1305Cipher.decrypt‰s~€ð ˜DŸJ™JÑ &ÜÐ?Ó@Ð @à <‰<œ=×=Ñ=Ò =Ø M‰MŒOà*ˆŒ
à  Š œ˜J›Ñ' Ø ×Ñ×"Ñ" :Ô.؏|‰|×#Ñ# J°vÐ#Ó>Ð>rcóÖ—|jr+|jtjk(sJ‚|jS|jtjk7sJ‚|jtjk(r|j «|j dzr.|jjdd|j dzz
z«tj|_|jjt|jd«ddd…«|jjt|j d«ddd…«|jj«|_|jS)z=Finalize the cipher (if not done already) and return the MAC.r8r9r:éNéÿÿÿÿ) r.r0r/rrr<r-r)rr    r,r!r;s rÚ _compute_macz#ChaCha20Poly1305Cipher._compute_mac¢s€ð =Š=Ø—<‘<¤=×#@Ñ#@Ò@Ð AÐ@Ø—=‘=Ð  à|‰|œ}×<Ñ<Ò<Ð=Ð<à <‰<œ=×=Ñ=Ò =Ø M‰MŒOà <‰<˜$Ò Ø × Ñ × &Ñ & w°"¸¿ ¹ ÀtÑ8KÑ2LÑ'MÔ Nä$×4Ñ4ˆŒ à ×Ñ×"Ñ"¤=°·±ÀÓ#BÁ4ÀRÀ4Ñ#HÔIØ ×Ñ×"Ñ"¤=°·±¸qÓ#AÁ$ÀBÀ$Ñ#GÔHØ×+Ñ+×2Ñ2Ó4ˆŒ ؏}‰}Ðrcób—d|jvr td«‚d|_|j«S)zgCompute the *binary* authentication tag (MAC).
 
        :Return: the MAC tag, as 16 ``bytes``.
        r!z digest() method cannot be called)r!)r'r4rIr;s rr!zChaCha20Poly1305Cipher.digest¸s2€ð ˜4Ÿ:™:Ñ %ÜÐ>Ó?Ð ?Ø ˆŒ
à× Ñ Ó"Ð"rc    ó~—dj|j«Dcgc]}dt|«z‘Œc}«Scc}w)zŸCompute the *printable* authentication tag (MAC).
 
        This method is like :meth:`digest`.
 
        :Return: the MAC tag, as a hexadecimal string.
        Úz%02x)Újoinr!r )r1Úxs  rÚ    hexdigestz ChaCha20Poly1305Cipher.hexdigestÄs0€ðw‰w°$·+±+³-Ö@¨Q˜¤ a£Ó(Ò@ÓAÐAùÒ@sž:cóF—d|jvr td«‚d|_td«}|j«t    j
d||j ¬«}t    j
d||¬«}|j«|j«k7r td«‚y)    aåValidate the *binary* authentication tag (MAC).
 
        The receiver invokes this method at the very end, to
        check if the associated data (if any) and the decrypted
        messages are valid.
 
        :param bytes/bytearray/memoryview received_mac_tag:
            This is the 16-byte *binary* MAC, as received from the sender.
        :Raises ValueError:
            if the MAC does not match. The message has been tampered with
            or the key is incorrect.
        r"z3verify() cannot be called when encrypting a message)r"r:é )Ú digest_bitsr#r6zMAC check failedN)    r'r4rrIrr(r.r!Ú
ValueError)r1Úreceived_mac_tagÚsecretÚmac1Úmac2s     rr"zChaCha20Poly1305Cipher.verifyÍs”€ð ˜4Ÿ:™:Ñ %Üð9ó:ð :à ˆŒ
ä! "Ó%ˆà ×ÑÔä{‰{ s°Ø $§ ¡ ô/ˆä{‰{ s°Ø 0ô2ˆð ;‰;‹=˜DŸK™K›MÒ )ÜÐ/Ó0Ð 0ð *rcó8—|jt|««y)a@Validate the *printable* authentication tag (MAC).
 
        This method is like :meth:`verify`.
 
        :param string hex_mac_tag:
            This is the *printable* MAC.
        :Raises ValueError:
            if the MAC does not match. The message has been tampered with
            or the key is incorrect.
        N)r"r)r1Ú hex_mac_tags  rÚ    hexverifyz ChaCha20Poly1305Cipher.hexverifyìs€ð      ‰ ”I˜kÓ*Õ+rcóD—|j|«|j«fS)aHPerform :meth:`encrypt` and :meth:`digest` in one step.
 
        :param plaintext: The data to encrypt, of any size.
        :type plaintext: bytes/bytearray/memoryview
        :return: a tuple with two ``bytes`` objects:
 
            - the ciphertext, of equal length as the plaintext
            - the 16-byte MAC tag
        r>)r1rAs  rÚencrypt_and_digestz)ChaCha20Poly1305Cipher.encrypt_and_digestús€ð|‰|˜IÓ&¨¯ © « Ð5Ð5rcóJ—|j|«}|j|«|S)aßPerform :meth:`decrypt` and :meth:`verify` in one step.
 
        :param ciphertext: The piece of data to decrypt.
        :type ciphertext: bytes/bytearray/memoryview
        :param bytes received_mac_tag:
            This is the 16-byte *binary* MAC, as received from the sender.
        :return: the decrypted data (as ``bytes``)
        :raises ValueError:
            if the MAC does not match. The message has been tampered with
            or the key is incorrect.
        rD)r1rErTrAs    rÚdecrypt_and_verifyz)ChaCha20Poly1305Cipher.decrypt_and_verifys%€ð—L‘L Ó,ˆ    Ø  ‰ Ð$Ô%ØÐr)N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r2rr<rr rIr!rOr"rZr\r^rrrrr5sD„ñò:ò$)ò,;óó:?ò2ò,
#òBò1ò> ,ò 6órrc óô—    |jd«}t|«dk7r t    d«‚|jdd«}|€ t d«}t|«dvr|}n1t|«d    k(rt ||dd
«}d |d
dz}n t    d «‚t|«s td «‚|rtdt|«z«‚t||«}tdd|«|_ |S#t$r}td|z«‚d}~wwxYw)aŽCreate a new ChaCha20-Poly1305 or XChaCha20-Poly1305 AEAD cipher.
 
    :keyword key: The secret key to use. It must be 32 bytes long.
    :type key: byte string
 
    :keyword nonce:
        A value that must never be reused for any other encryption
        done with this key.
 
        For ChaCha20-Poly1305, it must be 8 or 12 bytes long.
 
        For XChaCha20-Poly1305, it must be 24 bytes long.
 
        If not provided, 12 ``bytes`` will be generated randomly
        (you can find them back in the ``nonce`` attribute).
    :type nonce: bytes, bytearray, memoryview
 
    :Return: a :class:`Crypto.Cipher.ChaCha20.ChaCha20Poly1305Cipher` object
    r#zMissing parameter %sNé zKey must be 32 bytes longr$é )rGreér:sz$Nonce must be 8, 12 or 24 bytes longz,nonce must be bytes, bytearray or memoryviewzUnknown parameters: ) ÚpopÚKeyErrorr4r5rSrrr Ústrrr
r$)Úkwargsr#Úer$Úchacha20_poly1305_noncer%s      rr(r(s €ð*4؏j‰j˜Óˆô ˆ3ƒx2‚~ÜÐ4Ó5Ð5à J‰Jw Ó %€EØ €}Ü  Ó$ˆä
ˆ5ƒzWÑØ"'ÑÜ     ˆU‹rÒ    Ü˜˜e C R˜jÓ)ˆØ"5¸¸b¸c¸
Ñ"BÑäÐ?Ó@Ð@ä UÔ ÜÐFÓGÐGá ÜÐ.´°V³Ñ<Ó=Ð=ä # CÐ)@Ó A€Fܘt T¨5Ó1€F„LØ €Møô5 ò4ÜÐ.°Ñ2Ó3Ð3ûð4ús‚Cà   C7Ã$C2Ã2C7rdN)ÚbinasciirÚ Crypto.CipherrÚCrypto.Cipher.ChaCha20rÚ Crypto.HashrrÚ Crypto.RandomrÚCrypto.Util.numberr    ÚCrypto.Util.py3compatr
r ÚCrypto.Util._raw_apir rr/Úobjectrr(Úkey_sizerrrú<module>rwsTðõ>å"Ý-ß)å*å,ß3Ý*ò#ñ¨1Ø,-Ø&'ô)€ ô
a˜VôaòH1ðj r