This project aims to implement the AES (Advanced Encryption Standard) encryption algorithm from scratch, along with all the underlying algorithms it uses. The implementation is written in Zig, a programming language known for its performance, safety, and simplicity.
The goal of this project is to:
- Recreate the AES encryption algorithm from the ground up.
- Implement all associated cryptographic algorithms in Zig.
- Ensure clarity, performance, and correctness in the codebase.
- AES Encryption Algorithm: Full implementation of the core encryption and decryption algorithm.
- Sub-Algorithms: Includes all algorithms and utilities needed for the EAS encryption (e.g., key scheduling, side-ways shifting, etc.).
- Written in Zig: Utilizing the Zig programming language to ensure efficient and reliable cryptographic operations.
- AES-128 ✔
- AES-192 ✔ with 16-bits key duplication
- AES-256 ✔ with 16-bits key duplication
$ zig fetch --save https://github.com/irealycode/zigaes/archive/refs/tags/v0.1.0.tar.gz
in build.zig
const zigaes = b.dependency("zigaes", .{
.target = target,
.optimize = optimize,
}).module("zigaes");
exe.root_module.addImport("zigaes", zigaes);now you can import it !!
const aes = @import("zigaes");const aes = @import("zigaes");
const pt : []const u8 = "thisIsPlainTextToTestThisThing10";
const key : []const u8 = "rhe82kd8hrius9dn";
const enc = try aes.aesEncrypt(pt,key,128); // -> ![][16]u8
const str = try aes.asString(enc); // -> ![]u8returns
HEX
89 1f 58 07 c2 48 36 7c c9 b8 1f 92 3c 22 25 5a
59 1f 67 3b 73 78 75 50 b1 8d 2d 91 0f c2 bc f3
const aes = @import("zigaes");
const pt : []const u8 = "thisIsPlainTextToTestThisThing10";
const key : []const u8 = "rhe82kd8hrius9dn";
const enc = try aes.aesEncrypt(pt,key,256);
const dec = try aes.aesDecrypt(enc,key,256); // -> ![]u8
// aes.asNotString(data : []u8) -> ![][16]u8returns
STRING
"thisIsPlainTextToTestThisThing10"