libktorrent  2.1.1
Public Member Functions | List of all members
mse::RC4Encryptor Class Reference

#include <rc4encryptor.h>

Public Member Functions

 RC4Encryptor (const bt::SHA1Hash &dkey, const bt::SHA1Hash &ekey)
 
void decrypt (Uint8 *data, Uint32 len)
 
const Uint8 * encrypt (const Uint8 *data, Uint32 len)
 
void encryptReplace (Uint8 *data, Uint32 len)
 

Detailed Description

Author
Joris Guisson joris.nosp@m..gui.nosp@m.sson@.nosp@m.gmai.nosp@m.l.com

RC4 encryptor. Uses the RC4 algorithm to encrypt and decrypt data. This class has a static encryption buffer, which makes it not thread safe because the buffer is not protected by mutexes.

Definition at line 41 of file rc4encryptor.h.

Member Function Documentation

◆ decrypt()

void mse::RC4Encryptor::decrypt ( Uint8 *  data,
Uint32  len 
)

Decrypt some data, decryption happens in place (original data gets overwritten)

Parameters
dataThe data
lenSize of the data

◆ encrypt()

const Uint8* mse::RC4Encryptor::encrypt ( const Uint8 *  data,
Uint32  len 
)

Encrypt the data. Encryption happens into the static buffer. So that the data passed to this function is never overwritten. If we send pieces we point directly to the mmap region of data, this cannot be overwritten, hence the static buffer.

Parameters
dataThe data
lenThe length of the data
Returns
Pointer to the static buffer

◆ encryptReplace()

void mse::RC4Encryptor::encryptReplace ( Uint8 *  data,
Uint32  len 
)

Encrypt data, encryption will happen in the same buffer. So data will be changed replaced by it's encrypted version.

Parameters
dataThe data to encrypt
lenThe length of the data

The documentation for this class was generated from the following file: