
Radikant Crypto is a cryptolibrary providing cryptograhpic primivitves such as ECC, Hash and various ciphers and mac’s. Written in C with no external dependencies.
Radikant Crypto is a eductional implementation supporting common primitives. The cryptograhic core is seperated and decoupled. Currently works on arm64 hardware (apple silicon) and in software mode on 64 bit architecture, but can be easliy modified to run on other platforms or architectures aswell.
This library is an infamous example of “don’t roll your own crypto” it is incredibly insecure, its branchy, it leaks memory, information and secrets and is not constant time, lacks data validating api’s that are hardened against malicious input. Testing against RFC vectors has proven that the library is capable to produce the correct bit output and is further proven as it used as dependency inside Radikant TLS. There is only handfull of situations where it would be acceptable to use this in production. In general i highly recommend against it.
Cryptography is incredibly complex and it's suprisingly easy to get wrong. Don’t use this library for any other purposes other than research unless you are very confident about what you are doing.
Symmetric, Asysmetic, Block and Stream ciphers
Advances Encryption Standard for arm64 supporting cbc, ccm, ctr, ecb and gcm modes.
ChaCha with support for Poly1305 mac. Some arm64 support, by design for software mode.
Software only support for Salsa20 stream ciphers.
Bit accurate implementation of RSA for 2048 bit encryption.
Software only implementation of from 3th party source.
Software only implementation of SM4 cipher.
Software only implementation of TwoFish cipher from 3th party source.
Software only implementation of TwoFish.
uint8_t key[32] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
};
uint8_t iv[12] = {
0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD,
0xDE, 0xCA, 0xF8, 0x88
};
const char *aad_str = "Metadata: Header info";
const char *pt_str = "Secret Message: The eagle has landed.";
uint8_t *aad = (uint8_t*)aad_str; uint8_t *pt = (uint8_t*)pt_str;
size_t aad_len = strlen(aad_str); size_t pt_len = strlen(pt_str);
// 3. Prepare Output Buffers
uint8_t ct[pt_len];
uint8_t tag[16]; // 128-bit tag
uint8_t decrypted[pt_len + 1];
// 4. Initialize AES Context
aes_context_t ctx;
aes_key_setup(&ctx, key, sizeof(key));
aes_gcm_encrypt(&ctx, iv, sizeof(iv), aad, aad_len, pt, pt_len, ct, tag, sizeof(tag));
int res = aes_gcm_decrypt(&ctx, iv, sizeof(iv), aad, aad_len, ct, pt_len, tag, sizeof(tag), decrypted);
Hashing algorithms
Implementation of Blake3
Keccak that powers SHA3
Basic MD5 implementation
Chinese Hash
SHA1 software implementation.
SHA2 software implementation.
SHA3 software implementation.
SHAKE software implementation
int main() {
printf("\n--- SHAKE256 Example ---\n");
const char *shake_input = "Seychelles and Bonaire have beautiful beaches.";
uint8_t shake_output[64]; // 512 bits output
shake256(shake_output, sizeof(shake_output), shake_input, strlen(shake_input));
printf("Input: %s\n", shake_input);
print_hex("SHAKE256 Output (64 bytes)", shake_output, sizeof(shake_output));
return 0;
}
Eliptic curve cryptography
NIST secp224r1
NIST secp256r1
NIST secp384r1
NIST secp521r1
Software Implementation of DJB curve
ECDH & EdDSA for Curve 25519
Software Implementation of MH Curve
ECDH & EdDSA for Curve 448
uint8_t private_key[48];
uint8_t public_key[96];
uint8_t signature[96];
uint8_t msg_hash[48];
p384_generate_random(msg_hash, sizeof(msg_hash));
p384_gen_keypair(private_key, public_key)
p384_ecdsa_sign(signature, private_key, msg_hash, sizeof(msg_hash)
p384_ecdsa_verify(signature, public_key, msg_hash, sizeof(msg_hash)
Message Authentication Code
achieved 2x improvcement over openSSL using Kurdi & Möller 2025 paper on arm64.
Support for SHA1, SHA2-256, SHA2-384, SHA2-512,
Software implementation of Poly1305 only.
Fast software implementation of VMAC.
int main()
{
const char *key = "secret-key";
const char *msg = "Hello, world!";
uint8_t mac[SHA512_DIGEST_SIZE];
hmac_sha512(key, strlen(key), msg, strlen(msg), mac);
return 0;
}
Key Derivation Functions
Argon2 with Blake2
HMAC-based Extract-and-Expand Key Derivation Function
Password-Based Key Derivation Function 2
Scrypt
int main()
{
const char *password = "password";
const uint8_t salt[] = { 0x12, 0x34, 0x56, 0x78 };
uint32_t iterations = 4096;
uint8_t dk[64];
printf("--- PBKDF2-HMAC-SHA512 Example ---\n");
pbkdf2_hmac_sha512((const uint8_t*)password, strlen(password),
salt, sizeof(salt),
iterations, dk, sizeof(dk));
printf("Password: %s\n", password);
print_hex("Salt", salt, sizeof(salt));
printf("Iterations: %d\n", iterations);
print_hex("Derived Key", dk, sizeof(dk));
return 0;
}
In order to test the bit output of this library the build can produce seperate testing binaries specific for testing against rfc vectors. Since alot of cryptographic primitives are build ontop of eachother a very simple and rudimentary test setup is used for regression testing. Radikant probe is utilized for quick testing and Radikant Log for logging. The most commonly used primitives are now tested, but quite a few ciphers like SM2, Grashopper and many more havent been fully tested on correct output, but appear functional at first glance. One of the first next great improvements would be to focus on memory and constant time for major primitives.
Radikant Probe Output
FINAL SUMMARY REPORT | Radikant ECC X25519 Suite | RFC 7748 |------------------------------------------------------------------------------| | S | M | Ψ | ID | Status | Name | Standard | |---+---+---+------+--------+--------------------------------+-----------------| | ✓ | ✗ | ✓ | 0 | PASS | test_arithmetic_fuzz | Arithmetic Fuzz | | ✓ | ✗ | ✓ | 1 | PASS | test_rfc7748_vectors | RFC 7748 Vector | | ✓ | ✗ | ✓ | 2 | PASS | test_properties | Properties | | ✓ | ✗ | ✓ | 3 | PASS | test_edge_cases | Edge Cases | | ✓ | ✗ | ✓ | 4 | PASS | test_clamping_safety | Clamping Safety | | ✓ | ✓ | ✓ | 5 | PASS | test_monte_carlo_1k | Monte Carlo 1k | | ✓ | ✓ | ✓ | 6 | PASS | test_monte_carlo_1m | Monte Carlo 1M | ================================================================================ SUMMARY: 7 Tests Run | 7 Passed | 0 Failed ================================================================================