ffu rdZdgZddlmZmZmZmZmZmZm Z m Z eddZ Gdde Z dZdS) z" Electronic Code Book (ECB) mode. EcbMode)load_pycryptodome_raw_lib VoidPointercreate_string_bufferget_raw_buffer SmartPointerc_size_t c_uint8_ptris_writeable_bufferzCrypto.Cipher._raw_ecbak int ECB_start_operation(void *cipher, void **pResult); int ECB_encrypt(void *ecbState, const uint8_t *in, uint8_t *out, size_t data_len); int ECB_decrypt(void *ecbState, const uint8_t *in, uint8_t *out, size_t data_len); int ECB_stop_operation(void *state); c(eZdZdZdZddZddZdS)ra*Electronic Code Book (ECB)*. This is the simplest encryption mode. Each of the plaintext blocks is directly encrypted into a ciphertext block, independently of any other block. This mode is dangerous because it exposes frequency of symbols in your plaintext. Other modes (e.g. *CBC*) should be used instead. See `NIST SP800-38A`_ , Section 6.1. .. _`NIST SP800-38A` : http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf :undocumented: __init__ c|j|_t|_t||j}|rtd|zt|jtj |_| dS)zCreate a new block cipher, configured in ECB mode. :Parameters: block_cipher : C pointer A smart pointer to the low-level block cipher instance. z)Error %d while instantiating the ECB modeN) block_sizer_state raw_ecb_libECB_start_operationget address_of ValueErrorrECB_stop_operationrelease)self block_cipherresults y/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/_mode_ecb.py__init__zEcbMode.__init__Ds'1!mm 001A1A1C1C151G1G1I1IKK  'H%&'' ' #4;??#4#4#.#ACC Nc F|tt|}n_|}t|stdt|t|krt dt|zt |jt|t|tt|}|r'|dkrt dt d|z|t|SdS)abEncrypt data with the key set at initialization. The data to encrypt can be broken up in two or more pieces and `encrypt` can be called multiple times. That is, the statement: >>> c.encrypt(a) + c.encrypt(b) is equivalent to: >>> c.encrypt(a+b) This function does not add any padding to the plaintext. :Parameters: plaintext : bytes/bytearray/memoryview The piece of data to encrypt. The length must be multiple of the cipher block length. :Keywords: output : bytearray/memoryview The location where the ciphertext must be written to. If ``None``, the ciphertext is returned. :Return: If ``output`` is ``None``, the ciphertext is returned as ``bytes``. Otherwise, ``None``. N4output must be a bytearray or a writeable memoryview9output must have the same length as the input (%d bytes)2Data must be aligned to block boundary in ECB modez%Error %d while encrypting in ECB mode) rlenr TypeErrorrr ECB_encryptrrr r r)r plaintextoutput ciphertextrs rencryptzEcbMode.encrypt^s : >-c)nn==JJJ&v.. X VWWW9~~V,, "025i.."ABBB(():):)4Y)?)?)4Z)@)@)1#i..)A)ACC  O{{ !UVVVDvMNN N >!*-- -4rc F|tt|}n_|}t|stdt|t|krt dt|zt |jt|t|tt|}|r'|dkrt dt d|z|t|SdS)aeDecrypt data with the key set at initialization. The data to decrypt can be broken up in two or more pieces and `decrypt` can be called multiple times. That is, the statement: >>> c.decrypt(a) + c.decrypt(b) is equivalent to: >>> c.decrypt(a+b) This function does not remove any padding from the plaintext. :Parameters: ciphertext : bytes/bytearray/memoryview The piece of data to decrypt. The length must be multiple of the cipher block length. :Keywords: output : bytearray/memoryview The location where the plaintext must be written to. If ``None``, the plaintext is returned. :Return: If ``output`` is ``None``, the plaintext is returned as ``bytes``. Otherwise, ``None``. Nrrr r!z%Error %d while decrypting in ECB mode) rr"r r#rr ECB_decryptrrr r r)rr'r&r%rs rdecryptzEcbMode.decrypts : >,S__==III&v.. X VWWW:#f++-- "025i.."ABBB(():):)4Z)@)@)4Y)?)?)1#j//)B)BDD  O{{ !UVVVDvMNN N >!),, ,4r)N)__name__ __module__ __qualname____doc__rr(r+rrrr3sV 45555n555555rc ||}|j|_|rtdt|zt |S)aMInstantiate a cipher object that performs ECB encryption/decryption. :Parameters: factory : module The underlying block cipher, a module from ``Crypto.Cipher``. All keywords are passed to the underlying block cipher. See the relevant documentation for details (at least ``key`` will need to be presentzUnknown parameters for ECB: %s)_create_base_cipherrr#strr)factorykwargs cipher_states r_create_ecb_cipherr7sS..v66L%0L H83v;;FGGG <  rN)r/__all__Crypto.Util._raw_apirrrrrr r r robjectrr7r0rrr;s. -77777777777777777777 ('(@ C * * WWWWWfWWWt!!!!!r