interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / nvidia / om / cache / digest_test.om

54 lines · 830 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Concatenate digest.om, hash exact stdin bytes, emit binary digest for sha256sum comparison.
3fn main to int
4buf = new uchar 4096 0
5code = new uchar 16384 0
6other = new uchar 32 0
7out = new uchar 32 0
8extra = new uchar 1 0
9n = ulong 0
10while lt n 16384 bound 16384
11k = read 0 code n sub ulong 16384 n
12if lt k 0
13ret 1
14end
15if eq k 0
16break
17end
18n = add n ulong k
19end
20if eq n 16384
21k = read 0 extra 0 1
22if ne k 0
23ret 2
24end
25end
26if ne kc_sha buf 4097 other -1
27ret 5
28end
29if ne kc_codesha code n out 0
30ret 3
31end
32if le n 4096
33for i ulong n
34put buf i get code i
35end
36if ne kc_sha buf n other 0
37ret 6
38end
39for i ulong 32
40if ne get out i get other i
41ret 7
42end
43end
44end
45n = 0
46while lt n 32 bound 32
47k = write 1 out n sub ulong 32 n
48if le k 0
49ret 4
50end
51n = add n ulong k
52end
53ret 0
54end