0xwal / c-scratch

Essential programming tasks from scratch as a challenge and exercise. 🧩
MIT License
4 stars 1 forks source link

RC4 algorithm implementation in C #3

Closed 0xwal closed 3 years ago

0xwal commented 3 years ago

RC4 Encryption

Description:

Write the RC4 algorithm to encrypt/decrypt data.

Details:

Header:

src/include/rc4.h

Source file:

src/rc4.c

Test file:

tests/rc4.test.cpp

Signature:

void rc4(const char* key, size_t keyLength, const char* plain, size_t plainLength, char* result);

Test Cases:

  1. Input: key: "h" plain: "foo", output: result: "\xc7\x22\xc7"
  2. Input: key: "secret" plain: "foo", output: result: "\x8b\x59\xbd"

Restriction:

Note:

See Contribution Guide for more details.

Let me know if you are unable to write the tests, I will do that for you.

Also if you want any help let me know 😉.

0xwal commented 3 years ago

Done 🚀