U +Mb@snddlmZddlmZmZmZmZmZmZm Z m Z ddl m Z eddZ GdddZd d d Zd Zd ZdS)) _copy_bytes)load_pycryptodome_raw_libcreate_string_bufferget_raw_buffer VoidPointer SmartPointerc_size_t c_uint8_ptris_writeable_buffer)get_random_byteszCrypto.Cipher._Salsa20a int Salsa20_stream_init(uint8_t *key, size_t keylen, uint8_t *nonce, size_t nonce_len, void **pSalsaState); int Salsa20_stream_destroy(void *salsaState); int Salsa20_stream_encrypt(void *salsaState, const uint8_t in[], uint8_t out[], size_t len); c@s,eZdZdZddZd ddZd ddZdS) Salsa20CipherzSalsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string cCst|tkrtdt|t|dkr8tdt|tdd||_t|_tt |t t|t |t t||j }|rtdt |j tj|_d|_t||_dS)zQInitialize a Salsa20 cipher object See also `new()` at the module level.z+Incorrect key length for Salsa20 (%d bytes)z-Incorrect nonce length for Salsa20 (%d bytes)Nz'Error %d instantiating a Salsa20 cipher)lenkey_size ValueErrorrnoncer_state_raw_salsa20_libZSalsa20_stream_initr rZ address_ofrgetZSalsa20_stream_destroy block_size)selfkeyrresultrs (  ^