mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-27 09:32:34 +00:00
feat(rust,gui): Rust checksum engine + Game of Life desktop app
Rust kernel expansion:
- rust/src/checksum/mod.rs (new): memory-safe CRC-32C (Castagnoli), Adler-32,
and FNV-1a-64 with thin C-ABI shims. Registered in lib.rs with a boot-time
self-test (crc32c("SUB-OS")=0x61e96ce9, verified against a reference impl).
- include/kernel/rust.h: FFI declarations; rust/rust_fallback.c: matching C
fallbacks so aarch64/armv8i (no native rustc target) get identical results.
- LazyBox: new `cksum <text>` applet printing all three via the Rust engine.
GUI expansion:
- gui/gui_apps.c: Conway's Game of Life -- an interactive B3/S23 cellular
automaton with Play/Pause/Step/Random/Clear toolbar, click-to-toggle cells,
a live generation/population readout, and a board that scales with the
window. The Random button seeds from the Rust ChaCha20 CSPRNG. Toolbar and
cell input are gated on the MOUSE_DOWN edge so they do not re-fire while held.
- Registered "Life" (flask icon) in the desktop app table and on the desktop.
Verified: clean build on x86_64/aarch64/armv8i; boots through the SUB login to
the desktop (screenshotted) with the checksum self-test and 0 panics/0 OOM.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fh5z6V7nGPbHvqVG5p4CXX
This commit is contained in:
1 parent
c982d6b538
commit
e93b994469
8 files changed
+341
-1
No files matched your search
@@ -463,6 +463,25 @@ static int applet_crc32(int argc, char** argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int applet_cksum(int argc, char** argv) {
|
||||
const char* str = (argc >= 2) ? argv[1] : "";
|
||||
size_t len = strlen(str);
|
||||
const uint8_t* buf = (const uint8_t*)str;
|
||||
|
||||
// All three come from the memory-safe Rust checksum engine
|
||||
// (rust/src/checksum/mod.rs), with a C bridge on non-x86 targets.
|
||||
uint32_t crc = rust_crc32c(buf, len);
|
||||
uint32_t adl = rust_adler32(buf, len);
|
||||
uint64_t fnv = rust_fnv1a64(buf, len);
|
||||
|
||||
printk(ANSI_BRIGHT_CYAN "Rust checksum engine" ANSI_RESET " for \"%s\" (%llu bytes):\n",
|
||||
str, (unsigned long long)len);
|
||||
printk(" CRC-32C : 0x%08X\n", crc);
|
||||
printk(" Adler-32 : 0x%08X\n", adl);
|
||||
printk(" FNV-1a-64 : 0x%016llX\n", (unsigned long long)fnv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int applet_rand(int argc, char** argv) {
|
||||
int count = (argc >= 2) ? atoi(argv[1]) : 4;
|
||||
printk("Random Integers: ");
|
||||
@@ -2170,6 +2189,7 @@ static const lazybox_applet_t applets[] = {
|
||||
{"md5sum", applet_md5sum, "md5sum <file|text>", "Compute MD5 hash", "Crypto"},
|
||||
{"sha256sum", applet_sha256sum, "sha256sum <file|text>", "Compute SHA-256 hash", "Crypto"},
|
||||
{"crc32", applet_crc32, "crc32 <text>", "Calculate CRC32 checksum", "Crypto"},
|
||||
{"cksum", applet_cksum, "cksum <text>", "Rust CRC-32C/Adler-32/FNV", "Crypto"},
|
||||
{"rand", applet_rand, "rand [count]", "Generate random numbers", "Crypto"},
|
||||
{"certcheck", applet_certcheck, "certcheck", "View X.509 kernel keyring", "Security"},
|
||||
{"capsh", applet_capsh, "capsh", "View process capabilities", "Security"},
|
||||
|
||||
Reference in new issue
Block a user