1
edit
Changes
→Description
S[j] = temp;
return S[(S[i] + S[j]) & 0xFF];
}
Creating Kernels
/**
* Description: RC4 Cuda Kernel
**/
__global__ void getRC4Buffer(char * buffer, int bufferSize) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < bufferSize)
buffer[idx] = buffer[idx] ^ rc4_output();
}
/**
* Description: Cycle Cuda Kernel
**/
__global__ void getCycleBuffer(char * buffer, int bufferSize) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < bufferSize)
buffer[idx] = cycle(buffer[idx]);
}
/**
* Description: Inversion Cuda Kernel
**/
__global__ void getInversionBuffer(char * buffer, int bufferSize) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < bufferSize)
buffer[idx] = ~buffer[idx];
}
/**
* Description: XOR Cuda Kernel
**/
__global__ void getXorBuffer(char * buffer, char * keyBuffer, int bufferSize) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < bufferSize)
buffer[idx] = buffer[idx] ^ keyBuffer[idx];
}