37 lines
631 B
Zig
37 lines
631 B
Zig
|
|
// WARNING NOT FUNCTIONAL !!!
|
||
|
|
// This is just a draft
|
||
|
|
// TODO
|
||
|
|
|
||
|
|
///////////////// Imports
|
||
|
|
//
|
||
|
|
|
||
|
|
const AES = @import("crypto/aes.zig");
|
||
|
|
|
||
|
|
|
||
|
|
///////////////// Public functions
|
||
|
|
//
|
||
|
|
|
||
|
|
pub fn CryptoEngine(comptime Provider: anytype) type {
|
||
|
|
return struct {
|
||
|
|
const Self = @This();
|
||
|
|
|
||
|
|
pub const Aes = AES.AesEngine(Provider);
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
///////////////// Tests
|
||
|
|
//
|
||
|
|
|
||
|
|
const std = @import("std");
|
||
|
|
|
||
|
|
test "AES encryption defaults" {
|
||
|
|
|
||
|
|
const crypto = CryptoEngine();
|
||
|
|
|
||
|
|
var data = [_]u8{ 1, 2, 3, 4 };
|
||
|
|
const key = [_]u8{ 1, 2, 3, 4 };
|
||
|
|
const iv = [_]u8{ 1, 2, 3, 4 };
|
||
|
|
crypto.Aes.CBC_265.encrypt(&data, &key, &iv);
|
||
|
|
}
|