Initial commit: SUB-OS 64-Bit Production Monolithic Operating System with LazyBox userland suite

This commit is contained in:
subhobhai943 committed 2026-08-16 21:23:52 +05:30
commit cd9c786d14
88 files changed
+7132

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
#include <crypto/crypto.h>
static uint32_t crc32_table[256];
static bool table_computed = false;
static void make_crc32_table(void) {
uint32_t c;
for (uint32_t n = 0; n < 256; n++) {
c = n;
for (int k = 0; k < 8; k++) {
if (c & 1) {
c = 0xEDB88320L ^ (c >> 1);
} else {
c = c >> 1;
}
}
crc32_table[n] = c;
}
table_computed = true;
}
uint32_t crc32(uint32_t crc, const void* buf, size_t size) {
if (!table_computed) {
make_crc32_table();
}
const uint8_t* p = (const uint8_t*)buf;
crc = crc ^ 0xFFFFFFFF;
while (size--) {
crc = crc32_table[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
}
return crc ^ 0xFFFFFFFF;
}