27 lines
868 B
Zig
27 lines
868 B
Zig
pub const CBC256_Implementation = struct {
|
|
|
|
pub const BLOCK_SIZE = 16;
|
|
pub const KEY_SIZE = 32;
|
|
|
|
// NOTE: data should be padded to make its length be a multiple of BLOCK_SIZE
|
|
encypt: *const fn (key: *const [KEY_SIZE]u8, iv: *const [BLOCK_SIZE]u8, data: *const []u8) void,
|
|
decrypt: *const fn (key: *const [KEY_SIZE]u8, iv: *const [BLOCK_SIZE]u8, data: *const []u8) void,
|
|
};
|
|
|
|
// TODO
|
|
pub const CBC256_DefaultImplementation = struct {
|
|
|
|
// Zig stdlib seems to provide no support for AES CBC265
|
|
// It may need some custom implementation or another library
|
|
|
|
pub fn encrypt(key: *const [32]u8, iv: *const [16]u8, data: *const []u8) !void {
|
|
_ = key;
|
|
_ = iv;
|
|
_ = data;
|
|
}
|
|
pub fn decrypt(key: *const [32]u8, iv: *const [16]u8, data: *const []u8) !void {
|
|
_ = key;
|
|
_ = iv;
|
|
_ = data;
|
|
}
|
|
};
|