summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_log/fpm-door-lock-rf.md20
-rw-r--r--_log/site-search.md34
2 files changed, 21 insertions, 33 deletions
diff --git a/_log/fpm-door-lock-rf.md b/_log/fpm-door-lock-rf.md
index 7c2b9ef..e29f733 100644
--- a/_log/fpm-door-lock-rf.md
+++ b/_log/fpm-door-lock-rf.md
@@ -6,7 +6,7 @@ project: true
thumbnail: thumb_sm.jpeg
---
-Wanted to unlock door with fingerprint, wirelessly to avoid drilling.
+Wanted to unlock the door with fingerprint, wirelessly to avoid drilling.
2024-11: Started with basic 433MHz RF modules and two Arduinos. Connected data
lines of the transceivers to UART RXD/TXDs of the MCUs. Unreliable--constant
@@ -20,22 +20,10 @@ ATmega328P runs at 5V; RFM69 3.3V. Suspect logic-level converter (LLC) issues.
High resistance; Not enough swing.
2025-04: Ditched RFM69s. Switched to NRF24L01+ modules--data pins 5V tolerant,
-no LLC required. Spent six weekends writing a clean-room driver from scratch.
-Works like a charm.
+no LLC required. Spent six weekends writing a clean-room driver. Works like a
+charm.
-Basic security via xor cipher--good enough for a door behind a guard post and
-a gate:
-
-```
-void xor(const char *k, const char *s, char *d, uint8_t n)
-{
- int i;
- for (i = 0; i < n; i++)
- d[i] = s[i] ^ k[i];
-}
-```
-
-Resists replay attacks by cycling the key:
+XOR cipher encrypts RF channel. Key cycled to resist replay attacks:
```
static inline void keygen(char *buf, uint8_t n)
diff --git a/_log/site-search.md b/_log/site-search.md
index 4ccae3c..58146ad 100644
--- a/_log/site-search.md
+++ b/_log/site-search.md
@@ -11,21 +11,21 @@ JavaScript.
Architecture: browser → httpd → slowcgi → Perl CGI script.
-Perl, httpd, slowcgi are in the OpenBSD base system. Instead of secrets, file
-system permissions govern access.
+Perl, httpd, slowcgi are in the base system. Search is anonymous; file system
+permissions govern access.
-2025-12-30: Regex.
+2025-12-30: Regex search.
-140-line Perl script searches 500 files in 40ms. Fast enough; O(N) pull felt at
-higher file counts.
+Threw together a 140-line Perl script; searches 500 files in 40ms. Fast enough.
+O(N) drag felt at higher file counts.
-Introduces ReDoS and symlink attack vectors. Both can be mitigated. Tempted to
-stop here.
+Crawling files introduces ReDoS and symlink attack vectors. Both can be
+mitigated. Tempted to stop here.
-2026-01-03: Suffix array (SA) based index lookup.
+2026-01-03: Suffix array (SA) search.
-Slurping files on every request bothers me. Regex search depends almost
-entirely on hardware for speed.
+Regex search depends almost entirely on hardware for speed. Slurping files on
+every request bothers me.
Implemented SA index with three files: corpus.bin, sa.bin, file_map.dat. Index
built with site:
@@ -36,8 +36,8 @@ $ cd cgi-bin/
$ perl indexer.pl
```
-Indexer extracts HTML, lowercases, and encodes into UTF-8 binary sequences.
-Null byte sentinel for document boundaries. sa.bin stores suffix offsets as
+Indexer: Extracts HTML, lowercases, and encodes into UTF-8 binary sequences.
+Null byte sentinel marks document boundaries. sa.bin stores suffix offsets as
32-bit unsigned integers, sorted by lexicographical order:
```
@@ -67,8 +67,8 @@ SORTED SUFFIXES:
[7] x
```
-Time complexity: O(L⋅N log N). Fast path caps L at 64 bytes (length of cache
-line), reducing complexity to O(N log N).
+Sort is the bottleneck. Time complexity: O(L⋅N log N). Fast path caps L at 64
+bytes (length of a cache line) → O(N log N).
Search: Textbook range query with twin binary searches. Random access to
suffixes and the text made possible by the fixed-width offsets:
@@ -111,8 +111,8 @@ Benchmarks on T490 (i7-10510U, OpenBSD 7.8, article size: 16 KB).
- Search (SA): 0.0161 s
- Search (Regex): 0.9120 s
-Security: Derived from architectural simplicity. Zero dependencies to manage,
-no secrets to hide, no targets for lateral movement.
+Security: Derived from architectural simplicity. Zero dependencies to manage.
+No secrets to hide. No targets for lateral movement.
Runs in chroot.
@@ -120,7 +120,7 @@ Resource exhaustion and XSS attacks are inherent. Former mitigated by limiting
concurrent searches via lock-file semaphores. Query length (64B) and result set
(20) capped. All output is HTML-escaped to prevent XSS.
-Verdict: Fast. Durable. Secure by default.
+O(N) drag gone. Architecture durable; secure by default.
Commit: <a
href="https://git.asciimx.com/www/commit/?h=term&id=6da102d6e0494a3eac3f05fa3b2cdcc25ba2754e"