ludic/docs/language
Orkuncakilkaya 9ae69e64b4
All checks were successful
docs / build-and-deploy (push) Successful in 3s
feat(stdlib): Crypto.* — SHA-256 + HMAC-SHA256, constant-time verify (#19)
The security-sensitive counterpart to the fast, non-cryptographic Hash.*
library: standard, test-vector-backed hashing for signed saves and message
integrity, kept in its own namespace so nobody reaches for the wrong tool.

  Crypto.sha256(s)                SHA-256 -> 64-char lowercase hex
  Crypto.hmac_sha256(key, msg)    HMAC-SHA256 -> 64-char hex
  Crypto.verify_hmac(key, msg, mac)  recompute + constant-time compare -> bool
  Crypto.hex(s)                   lowercase hex of a string's bytes
  Crypto.ct_equal(a, b)           constant-time string equality

The primitives are implemented from scratch in plain integer LLVM IR
(FIPS 180-4 / RFC 2104): no libc crypto, no data-dependent branches in the
compression rounds, so a given input hashes to the same 32 bytes on every
platform and run. Digests are returned as hex strings, not raw bytes, because
a `str` is null-terminated and a raw digest can contain a NUL. MAC checks use
a non-short-circuiting compare so timing does not leak how much of a forged tag
was correct.

Emitted on demand via g_uses_cryptort, mirroring the emit_hash prelude gate.
Scoped to the deterministic, known-answer-testable core; OS-backed
random_bytes (the one piece that can't be validated by test vectors) is left
for a follow-up.

Tested against published SHA-256 vectors (empty/"abc"/fox + 55/56/64-byte
multi-block padding) and HMAC-SHA256 vectors; wired into the self-host suite as
`crypto`. Docs: a new Crypto section with honest "what this protects / does
not" guidance, one page per method, all fences checked and in the inventory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-30 13:37:02 +03:00
..
annotations refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
builtins refactor(lang): rename builtins flr->floor and fx->fixed 2026-08-30 02:01:56 +03:00
clock feat(stdlib): DateTime format/parse + simulated Clock — completes #9 2026-08-30 03:51:48 +03:00
collision refactor(stdlib): de-abbreviate namespaces (Mem/Sys/Net/Collide) 2026-08-30 01:30:47 +03:00
color feat(stdlib): namespaced standard library (issue #2) 2026-08-30 00:26:19 +03:00
colors docs: add Networking section + process/OS builtins (net_send, owner, is_server, serialize/apply, arg, exit, run, getenv, read_char, file_*) 2026-08-29 16:39:29 +03:00
control feat(stdlib): namespaced standard library (issue #2) 2026-08-30 00:26:19 +03:00
crypto feat(stdlib): Crypto.* — SHA-256 + HMAC-SHA256, constant-time verify (#19) 2026-08-30 13:37:02 +03:00
date feat(stdlib): Time/Date/Duration calendar-clock core (issue #9) 2026-08-30 03:37:38 +03:00
datetime feat(stdlib): DateTime format/parse + simulated Clock — completes #9 2026-08-30 03:51:48 +03:00
duration feat(stdlib): Time/Date/Duration calendar-clock core (issue #9) 2026-08-30 03:37:38 +03:00
ease feat(stdlib): Math.exp/log/pow + Ease.elastic transcendentals (issue #25) 2026-08-30 01:19:44 +03:00
ecs refactor(lang): rename the str type (and stringify builtin) to string 2026-08-30 01:51:11 +03:00
events docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
hash feat(lang,stdlib): 64-bit long type + 64-bit Hash variants (issue #17) 2026-08-30 01:01:06 +03:00
input docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
list feat(stdlib): sorting toolkit — sort_by/sort_desc_by/sort_with + stable merge sort (#11) 2026-08-30 11:39:26 +03:00
map docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
math refactor(lang): rename builtins flr->floor and fx->fixed 2026-08-30 02:01:56 +03:00
memory refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
network refactor(stdlib): de-abbreviate namespaces (Mem/Sys/Net/Collide) 2026-08-30 01:30:47 +03:00
networking docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
operators refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
phases docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
random feat(stdlib): namespaced standard library (issue #2) 2026-08-30 00:26:19 +03:00
save feat(stdlib): namespaced standard library (issue #2) 2026-08-30 00:26:19 +03:00
scenes docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards 2026-08-29 17:53:22 +03:00
screen feat(stdlib): namespaced standard library (issue #2) 2026-08-30 00:26:19 +03:00
structure refactor(lang): rename builtins flr->floor and fx->fixed 2026-08-30 02:01:56 +03:00
system refactor(lang): rename the ptr/ptrs types to pointer/pointers 2026-08-30 01:58:54 +03:00
text refactor(lang): rename the str type (and stringify builtin) to string 2026-08-30 01:51:11 +03:00
time feat(stdlib): Time/Date/Duration calendar-clock core (issue #9) 2026-08-30 03:37:38 +03:00
types feat(stdlib): 2D Vector type + Vector.* namespace (issue #25) 2026-08-30 02:09:38 +03:00
vector feat(stdlib): 2D Vector type + Vector.* namespace (issue #25) 2026-08-30 02:09:38 +03:00
world feat(stdlib): namespaced standard library (issue #2) 2026-08-30 00:26:19 +03:00