Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/ng/gpu/pinsum.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / ng / gpu / pinsum.om` 47 lines ยท 1313 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note seed/ng/gpu/pinsum.om: SHA-256 of standard input, printed as 64 lowercase hex digits and a newline. 3 note It is the filter of gate.cases' lock-* cases, which enforce seed/ng/cudapp.lock: STDIN is the raw 4 note file, STDOUT the line the lock pins. Program mode, no om2 line, prefix ps_. 5 note Compiled after the plain-function form of om/sha256/sha256-om2.om (FIPS 180-4, the bridge's 6 note sha256 unit), exactly as seed/semhash builds: gate.cases joins five pack: segments of that file 7 note that skip the four "export " prefixes (bytes 7196, 8356, 8545 and 9149, 7 bytes each), then this file. 8 note Exit 0 with the digest; a read error writes one stderr line and exits 93; an output error exits 93. 9 text ps_erd "pinsum: read failed\n" 10 11 fn ps_hx x ulong to uchar 12 if lt x 10 13 ret uchar add x 48 14 end 15 ret uchar add x 87 16 end 17 18 fn main to int 19 c = new uchar 104 0 20 sha256_init c 21 k = new uchar 65536 0 22 for a ulong `1000000000` 23 r = read 0 k 0 65536 24 if lt r 0 25 w = write 2 ps_erd 0 len ps_erd 26 exit 93 27 end 28 if eq r 0 29 break 30 end 31 sha256_update c part k 0 ulong r 32 end 33 h = new uchar 32 0 34 sha256_final c h 35 o = new uchar 65 0 36 for i ulong 32 37 v = ulong get h i 38 put o mul i 2 ps_hx shr v 4 39 put o add mul i 2 1 ps_hx and v 15 40 end 41 put o 64 uchar 10 42 q = write 1 o 0 65 43 if ne q 65 44 exit 93 45 end 46 ret 0 47 end