Skip to content

netsh91/xor-bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

xor-bench

This project was supposed to become a file encryption program, but getting it run faster turned out to be much more exiting.

Given a naive algorithm:

void encrypt(uint8_t* data_buffer, size_t data_size, uint8_t* key_buffer, size_t key_size)
{
    size_t key_index = 0;
    size_t buffer_index = 0;

    for (buffer_index = 0; buffer_index < data_size; buffer_index++) {
        if (key_index >= key_size) {
            key_index = 0;
        }
        data_buffer[buffer_index] ^= key_buffer[key_index];
        key_index++;
    }
}

Which xor^s continuously a buffer with key, how much faster can it get by optimizing the code?

Additionally see how different compilers and compiler optimizations affect performance.

About

RAM speed is the limit!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages