A header-only implementation of RC4 in C.
  • C 96.3%
  • Shell 3.7%
Find a file
2026-06-13 11:14:17 +10:00
src Initial commit 2026-06-13 11:14:17 +10:00
tests Initial commit 2026-06-13 11:14:17 +10:00
.gitignore Initial commit 2026-06-13 11:14:17 +10:00
build.sh Initial commit 2026-06-13 11:14:17 +10:00
ReadMe.md Initial commit 2026-06-13 11:14:17 +10:00
UNLICENSE Initial commit 2026-06-13 11:14:17 +10:00

RC4 Cipher

Overview

This program is an implementation of the RC4.

https://en.wikipedia.org/wiki/RC4

It is designed to work with text-based input.

The code is written as a "header-only" implementation.

Build

Use the following command to build the program:

./build.sh

Usage

To encrypt a string:

./bin/rc4 -k Secret -e "Attack at dawn"

The above command returns:

45A01F645FC35B383552544B9BF5

To decrypt a string:

./bin/rc4 -k Secret -d 45A01F645FC35B383552544B9BF5

The above command returns:

Attack at dawn

Test

To confirm the code handles memory allocation correctly:

valgrind --leak-check=full --verbose ./bin/rc4 -k password -e "Attack at dawn"

To test the code:

cd tests
./test.sh