code wiki / (root) / nx_base64.nx

nx_base64.nx

buildroot/runtime/nx_base64.nx

6829 B179 linesdepth 0pulls 0 transitivereach 768 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

base64.nx -- RFC 4648 base64 encoder + decoder. Canonical: this is the substrate-wide canonical Base64 (RFC 4648 §4 standard alphabet) per [[feedback-no-tool-proliferation-bit- level]]. Variants that need URL-safe alphabet (RFC 4648 §5) are candidates for ONE distinct sibling primitive nx_base64_url.nx (queued) that imports THIS file's encode/decode skeleton; all other consumers compose THIS file's encode/decode primitives. Re-implementing the Base64 alphabet or quantum-loop inline is refused. Used for: - PEM decoding of X.509 certs (thin ASCII wrapper around DER) - TLS 1.3 pre-shared key encoding - HTTP Basic auth, OAuth tokens, JWT - Web content (data: URIs, JSON-embedded bytes) Standard alphabet (RFC 4648 §4): 0-25 : A-Z 26-51 : a-z 52-61 : 0-9 62 : + 63 : / pad : = URL-safe alphabet variant (§5) swaps +/ for -_; provided as b64url_encode / b64url_decode. Invariants: B1 Input/output lengths are predictable: encode(n bytes) -> 4 * ceil(n / 3) chars decode(n chars) -> 3 * (n / 4) - padding bytes B2 Decoder rejects invalid input (non-alphabet chars) by returning a negative length. No silent skip. B3 Decoder is tolerant of missing padding (RFC 4648 §3.2 permits this as "unpadded" variant). B4 Encoder is deterministic; same input -> same output. No trailing whitespace, no line breaks inserted. Callers that want MIME-style 76-char wrap do it outside.

dependencies 0 imports · 160 importers

nx_base64.nx _h2_multistream_curl_daemon.nx _h2_serve_curl_daemon.nx nx_audio_sfx_web.nx nx_audio_sfx_web_test.nx nx_audio_web.nx nx_audio_web_test.nx nx_authz_session_gate.nx nx_b64_cli.nx nx_base64_extvec_gate.nx nx_basic_auth.nx

diagram shows first 10 each side; +0 more imports, +150 more importers in the complete lists below.

imports: none

imported by: _h2_multistream_curl_daemon.nx_h2_serve_curl_daemon.nxnx_audio_sfx_web.nxnx_audio_sfx_web_test.nxnx_audio_web.nxnx_audio_web_test.nxnx_authz_session_gate.nxnx_b64_cli.nxnx_base64_extvec_gate.nxnx_basic_auth.nxnx_chip8_page.nxnx_connect_device_client.nxnx_connect_e2e_client.nxnx_content_get.nxnx_content_get_client.nxnx_content_get_gate.nxnx_content_put.nxnx_content_put_client.nxnx_content_put_gate.nxnx_csrf_token.nxnx_email_dns_gate.nxnx_email_mime.nxnx_email_provision_lib.nxnx_email_send.nxnx_email_submit.nxnx_email_submit_gate.nxnx_game_gallery.nxnx_game_page_affine_candidate_t361.nxnx_game_page_artifact_lib.nxnx_game_page_authored_material_t54.nxnx_game_page_body_t138.nxnx_game_page_canonical_t135.nxnx_game_page_catwalk_lighting_candidate_t316.nxnx_game_page_emit.nxnx_game_page_emit_sand_review.nxnx_game_page_eye_t138.nxnx_game_page_gait_candidate_t139.nxnx_game_page_garment_t132.nxnx_game_page_gpu_timing_current_candidate.nxnx_game_page_gpu_timing_pool_candidate.nxnx_game_page_hair_attachment_candidate_t263.nxnx_game_page_hair_attachment_t283.nxnx_game_page_hair_guides_candidate_t263.nxnx_game_page_hair_t138.nxnx_game_page_host_candidate_t341.nxnx_game_page_identity_candidate.nxnx_game_page_imported_body_t45.nxnx_game_page_imported_t262.nxnx_game_page_inspection_distance_t235.nxnx_game_page_inspection_t142.nxnx_game_page_integrated_t73.nxnx_game_page_knight_bind_t25.nxnx_game_page_knight_feedback_t28.nxnx_game_page_knight_feedback_t29.nxnx_game_page_knight_support_t31.nxnx_game_page_knight_support_t31_before_t44.nxnx_game_page_length_diag_t140.nxnx_game_page_lit_candidate_t181.nxnx_game_page_material_body_t61.nxnx_game_page_material_candidate_t181.nxnx_game_page_material_compose_t55.nxnx_game_page_material_schema_candidate_t181.nxnx_game_page_metadata_candidate_t220.nxnx_game_page_mip_candidate_t241.nxnx_game_page_motion_candidate_t328.nxnx_game_page_motion_inventory_candidate_t330.nxnx_game_page_move_t72.nxnx_game_page_owned_candidate_t181.nxnx_game_page_pipeline_t64.nxnx_game_page_pre_inspection_t142.nxnx_game_page_pre_toon_region_t143.nxnx_game_page_procedural_review_candidate_t333.nxnx_game_page_recovery_feedback_t28.nxnx_game_page_recovery_t23.nxnx_game_page_rig_comparison_t332.nxnx_game_page_rig_inspection_t230.nxnx_game_page_rig_observation_candidate_t331.nxnx_game_page_scene_light_candidate_t364.nxnx_game_page_search_t53.nxnx_game_page_shared_candidate_t340.nxnx_game_page_sink_t221.nxnx_game_page_skin_t138.nxnx_game_page_static_candidate_t338.nxnx_game_page_toon_region_candidate_t143.nxnx_game_page_visitors_inspection_t142.nxnx_game_page_visitors_t140.nxnx_game_page_workbench_candidate_t342.nxnx_game_page_workspace_body_t49.nxnx_game_page_workspace_body_t59.nxnx_game_page_workspace_t48.nxnx_gen_explorer.nxnx_gltf_accessor_candidate_t181.nxnx_gltf_load.nxnx_gltf_load_inventory_t180.nxnx_gltf_load_preserve_t145.nxnx_gpu_capture_store_lib.nxnx_gsplat_showcase.nxnx_h2_test_leaf.nxnx_jwt.nxnx_knight_bind_t24.nx +60 more (shown cap 100 declared)

structs

none

consts

58const B64_PAD: i64 = 0x3D // '='

functions

61func b64_enc_char(n: i64) -> i64
called by 1: b64_encode
71func b64url_enc_char(n: i64) -> i64
82func b64_dec_char(c: i64) -> i64
called by 2: b64_grabgpa_compose
95func b64_encode(in_bytes: *u8, n: i64, out: *u8) -> i64
132func b64_grab(in_chars: *u8, n: i64, pos: *i64) -> i64
called by 1: b64_decode calls 1: b64_dec_char
151func b64_decode(in_chars: *u8, n: i64, out: *u8) -> i64