mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* crypto: add AES algorithm * Some updates to the API * Silence test. * Fixed stdlib tests * Some cleanup. Comments. Make internal methods functions. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
12 lines
256 B
Plaintext
12 lines
256 B
Plaintext
module std::crypto;
|
|
|
|
fn bool safe_compare(void* data1, void* data2, usz len)
|
|
{
|
|
char match = 0;
|
|
for (usz i = 0; i < len; i++)
|
|
{
|
|
match = match | (mem::@volatile_load(((char*)data1)[i]) ^ mem::@volatile_load(((char*)data2)[i]));
|
|
}
|
|
return match == 0;
|
|
}
|