substrate-lang 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/compiler/{binary.5d81a93450b2@0+0.wasm → binary.3823f89ce414@0+0.wasm} +0 -0
- package/build/compiler/{checker.73d84d96c58b@0+0.wasm → checker.592d37dcbec9@0+0.wasm} +0 -0
- package/build/compiler/{compile.2db0f824839f@0+0.wasm → compile.86a2b03b0c9b@0+0.wasm} +0 -0
- package/build/compiler/{core.11abd90bead5@0+0.wasm → core.fc3dab9d1846@0+0.wasm} +0 -0
- package/build/compiler/expander.689d326e5a1b@0+0.wasm +0 -0
- package/build/compiler/{fs.3f7cf768e7ed@0+0.wasm → fs.563034be70c3@0+0.wasm} +0 -0
- package/build/compiler/{leb128.0d2a247f239f@0+0.wasm → leb128.748b1c37277a@0+0.wasm} +0 -0
- package/build/compiler/{link.3c4158bb6ba3@0+0.wasm → link.11b643d35670@0+0.wasm} +0 -0
- package/build/compiler/{macros.6f0e1a78d640@0+0.wasm → macros.4083601c00db@0+0.wasm} +0 -0
- package/build/compiler/main.ed62cce43000@0+0.wasm +0 -0
- package/build/compiler/{ops.a5b9269c5240@0+0.wasm → ops.b361e858d8e1@0+0.wasm} +0 -0
- package/build/compiler/{path.ec5532669c81@0+0.wasm → path.dcc4712bcc7b@0+0.wasm} +0 -0
- package/build/compiler/program +21 -20
- package/build/compiler/{prune.f800615ca8cc@0+0.wasm → prune.d4a3f9834095@0+0.wasm} +0 -0
- package/build/compiler/{reader.f4378a1f91d1@0+0.wasm → reader.b535e61f99f4@0+0.wasm} +0 -0
- package/build/compiler/roots.6d2942578055@0+0.wasm +0 -0
- package/build/compiler/{running.7f03ff780e03@0+0.wasm → running.d73f7826cb74@0+0.wasm} +0 -0
- package/build/compiler/{serialize.f4354af92feb@0+0.wasm → serialize.b2196de75bc8@0+0.wasm} +0 -0
- package/build/compiler/sha256.5fc9d60f8bb2@0+0.wasm +0 -0
- package/build/compiler/substrate.4c780d6dd6d4@0+0.wasm +0 -0
- package/build/compiler/{syntax.500cf1bcecd4@0+0.wasm → syntax.9857f6784d63@0+0.wasm} +0 -0
- package/build/compiler/{writer.b698107b491f@0+0.wasm → writer.806bc85aa684@0+0.wasm} +0 -0
- package/build/sub/{base64.fc39f9b2a664@0+0.wasm → base64.8fba03e1be0a@0+0.wasm} +0 -0
- package/build/sub/{build.3a016536f5a5@0+0.wasm → build.84ac996eda63@0+0.wasm} +0 -0
- package/build/sub/{chromium.0cdcaad35704@0+0.wasm → chromium.e4db7d29897c@0+0.wasm} +0 -0
- package/build/sub/{common.9ea008df47e6@0+0.wasm → common.91ddee6b7a67@0+0.wasm} +0 -0
- package/build/sub/deflate.fc8075e3aed1@0+0.wasm +0 -0
- package/build/sub/{doc.e0af22e9d586@0+0.wasm → doc.0b48bbac404b@0+0.wasm} +0 -0
- package/build/sub/{doc.49b234ac4521@0+0.wasm → doc.566f9861828e@0+0.wasm} +0 -0
- package/build/sub/env.f051f8166526@0+0.wasm +0 -0
- package/build/sub/events.f952172735e0@0+0.wasm +0 -0
- package/build/sub/fetch.097f1cc9502d@0+0.wasm +0 -0
- package/build/sub/{fetch.59ad8bf17eeb@0+0.wasm → fetch.5d2f427c995e@0+0.wasm} +0 -0
- package/build/sub/{files.25d3fe28ff57@0+0.wasm → files.30e55182c5df@0+0.wasm} +0 -0
- package/build/sub/{fs.3f7cf768e7ed@0+0.wasm → fs.563034be70c3@0+0.wasm} +0 -0
- package/build/sub/{git.c47e41fed371@0+0.wasm → git.48aefa1644be@0+0.wasm} +0 -0
- package/build/sub/{grants.e7dc20c93375@0+0.wasm → grants.5bf25700d47c@0+0.wasm} +0 -0
- package/build/sub/{gzip.0bacbb40f6e2@0+0.wasm → gzip.69588e97c35a@0+0.wasm} +0 -0
- package/build/sub/{hash.75dc86b3dd19@0+0.wasm → hash.3f0d118da63f@0+0.wasm} +0 -0
- package/build/sub/{html.1ab670c5f861@0+0.wasm → html.20baa1dc7ca6@0+0.wasm} +0 -0
- package/build/sub/{html.a860b2ff2c4e@0+0.wasm → html.c1671a102b4d@0+0.wasm} +0 -0
- package/build/sub/{inflate.16c735654147@0+0.wasm → inflate.8899e0933792@0+0.wasm} +0 -0
- package/build/sub/{json.74966c67a96d@0+0.wasm → json.f15a29d99d8d@0+0.wasm} +0 -0
- package/build/sub/{manifest.0c0fe02b1e58@0+0.wasm → manifest.cf7471880377@0+0.wasm} +0 -0
- package/build/sub/{map.b767b94ffe7f@0+0.wasm → map.dc516eec27ff@0+0.wasm} +0 -0
- package/build/sub/{pack.a62f186e997c@0+0.wasm → pack.55992e8cc09c@0+0.wasm} +0 -0
- package/build/sub/path.b7a8e1cf3aaa@0+0.wasm +0 -0
- package/build/sub/{path.ec5532669c81@0+0.wasm → path.dcc4712bcc7b@0+0.wasm} +0 -0
- package/build/sub/{process.94378bb2ecf2@0+0.wasm → process.aea2c88cb7a0@0+0.wasm} +0 -0
- package/build/sub/program +48 -48
- package/build/sub/{read.4b71de2f3337@0+0.wasm → read.cd1e693f4fb4@0+0.wasm} +0 -0
- package/build/sub/{reader.f4378a1f91d1@0+0.wasm → reader.b535e61f99f4@0+0.wasm} +0 -0
- package/build/sub/{root.5a3e4a594d25@0+0.wasm → root.9b713ec588c1@0+0.wasm} +0 -0
- package/build/sub/roots.6d2942578055@0+0.wasm +0 -0
- package/build/sub/{sha256.92185201fb4b@0+0.wasm → sha256.5fc9d60f8bb2@0+0.wasm} +0 -0
- package/build/sub/{sha512.bf0d4c469a96@0+0.wasm → sha512.b988b9dc6114@0+0.wasm} +0 -0
- package/build/sub/{site.81b7f3938874@0+0.wasm → site.7c6d8c7747af@0+0.wasm} +0 -0
- package/build/sub/site.81548474c323@0+0.wasm +0 -0
- package/build/sub/{store.128b4d772823@0+0.wasm → store.d4e845ff24ac@0+0.wasm} +0 -0
- package/build/sub/{stream.d95d09173ea2@0+0.wasm → stream.4c07247477f7@0+0.wasm} +0 -0
- package/build/sub/{sub.84126bd636af@0+0.wasm → sub.b57e17b6876b@0+0.wasm} +0 -0
- package/build/sub/{substrate.b31300129ffb@0+0.wasm → substrate.4c780d6dd6d4@0+0.wasm} +0 -0
- package/build/sub/{syntax.500cf1bcecd4@0+0.wasm → syntax.9857f6784d63@0+0.wasm} +0 -0
- package/build/sub/{tar.9c01735ea170@0+0.wasm → tar.e482cf873cfc@0+0.wasm} +0 -0
- package/build/sub/{test.eed7cfa3264c@0+0.wasm → test.0d9c079bb309@0+0.wasm} +0 -0
- package/build/sub/{text.ca2b0668e319@0+0.wasm → text.4ab70ac35b5a@0+0.wasm} +0 -0
- package/build/sub/{timer.21d74714d40b@0+0.wasm → timer.3809bb17a7a1@0+0.wasm} +0 -0
- package/build/sub/{upgrade.61c36d2a50cf@0+0.wasm → upgrade.18a5aa0dae89@0+0.wasm} +0 -0
- package/build/sub/{utf8.b61525c6fb12@0+0.wasm → utf8.524c475ecd40@0+0.wasm} +0 -0
- package/build/sub/worker.f1190de21b21@0+0.wasm +0 -0
- package/build/sub/writer.806bc85aa684@0+0.wasm +0 -0
- package/package.json +1 -1
- package/std/crypto/sha256.sub +3 -109
- package/std/test/session.sub +0 -1
- package/substrate/VERSION +1 -1
- package/substrate/compiler/checker.sub +1 -1
- package/substrate/compiler/expander.sub +187 -55
- package/substrate/compiler/main.sub +15 -2
- package/substrate/compiler/roots.sub +90 -24
- package/substrate/compiler/sha256.sub +110 -0
- package/substrate/compiler/substrate.sub +6 -1
- package/substrate/host/node/worker-thread.mjs +1 -1
- package/substrate/host/node/worker.mjs +1 -0
- package/substrate/host/subhost-core.mjs +10 -3
- package/substrate/host/subhost.mjs +13 -1
- package/substrate/host/web/subhost-web.mjs +13 -2
- package/substrate/host/web/worker-script.mjs +1 -0
- package/substrate/host/web/worker.mjs +1 -0
- package/substrate/host/worker.mjs +3 -1
- package/build/compiler/expander.570faeb51e05@0+0.wasm +0 -0
- package/build/compiler/main.1b378cf3c2a5@0+0.wasm +0 -0
- package/build/compiler/roots.02808ca2c6a7@0+0.wasm +0 -0
- package/build/compiler/substrate.b31300129ffb@0+0.wasm +0 -0
- package/build/sub/deflate.67457f2269ae@0+0.wasm +0 -0
- package/build/sub/env.d4a2d3ca5408@0+0.wasm +0 -0
- package/build/sub/events.ee8945a7ea00@0+0.wasm +0 -0
- package/build/sub/fetch.22f5c88f8a7b@0+0.wasm +0 -0
- package/build/sub/path.b98f74b36b19@0+0.wasm +0 -0
- package/build/sub/roots.02808ca2c6a7@0+0.wasm +0 -0
- package/build/sub/site.b678ce0b53b9@0+0.wasm +0 -0
- package/build/sub/worker.5ced1d8ab0d4@0+0.wasm +0 -0
- package/build/sub/writer.b698107b491f@0+0.wasm +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/compiler/program
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
substrate.
|
|
2
|
-
writer.
|
|
3
|
-
syntax.
|
|
4
|
-
path.
|
|
5
|
-
fs.
|
|
6
|
-
reader.
|
|
7
|
-
roots.
|
|
8
|
-
running.
|
|
9
|
-
core.
|
|
10
|
-
ops.
|
|
11
|
-
checker.
|
|
12
|
-
leb128.
|
|
13
|
-
binary.
|
|
14
|
-
serialize.
|
|
15
|
-
compile.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
substrate.4c780d6dd6d4@0+0
|
|
2
|
+
writer.806bc85aa684@0+0
|
|
3
|
+
syntax.9857f6784d63@0+0
|
|
4
|
+
path.dcc4712bcc7b@0+0
|
|
5
|
+
fs.563034be70c3@0+0
|
|
6
|
+
reader.b535e61f99f4@0+0
|
|
7
|
+
roots.6d2942578055@0+0
|
|
8
|
+
running.d73f7826cb74@0+0
|
|
9
|
+
core.fc3dab9d1846@0+0
|
|
10
|
+
ops.b361e858d8e1@0+0
|
|
11
|
+
checker.592d37dcbec9@0+0
|
|
12
|
+
leb128.748b1c37277a@0+0
|
|
13
|
+
binary.3823f89ce414@0+0
|
|
14
|
+
serialize.b2196de75bc8@0+0
|
|
15
|
+
compile.86a2b03b0c9b@0+0
|
|
16
|
+
sha256.5fc9d60f8bb2@0+0
|
|
17
|
+
link.11b643d35670@0+0
|
|
18
|
+
macros.4083601c00db@0+0
|
|
19
|
+
expander.689d326e5a1b@0+0
|
|
20
|
+
prune.d4a3f9834095@0+0
|
|
21
|
+
main.ed62cce43000@0+0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/sub/program
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
substrate.
|
|
2
|
-
process.
|
|
3
|
-
path.
|
|
4
|
-
path.
|
|
5
|
-
fs.
|
|
6
|
-
common.
|
|
7
|
-
grants.
|
|
8
|
-
writer.
|
|
9
|
-
syntax.
|
|
10
|
-
reader.
|
|
11
|
-
roots.
|
|
12
|
-
read.
|
|
13
|
-
manifest.
|
|
14
|
-
git.
|
|
15
|
-
files.
|
|
16
|
-
sha256.
|
|
17
|
-
hash.
|
|
18
|
-
store.
|
|
19
|
-
map.
|
|
20
|
-
env.
|
|
21
|
-
events.
|
|
22
|
-
build.
|
|
23
|
-
pack.
|
|
24
|
-
site.
|
|
25
|
-
site.
|
|
26
|
-
fetch.
|
|
27
|
-
stream.
|
|
28
|
-
worker.
|
|
29
|
-
deflate.
|
|
30
|
-
inflate.
|
|
31
|
-
gzip.
|
|
32
|
-
tar.
|
|
33
|
-
fetch.
|
|
34
|
-
doc.
|
|
35
|
-
html.
|
|
36
|
-
html.
|
|
37
|
-
text.
|
|
38
|
-
root.
|
|
39
|
-
doc.
|
|
40
|
-
timer.
|
|
41
|
-
chromium.
|
|
42
|
-
test.
|
|
43
|
-
utf8.
|
|
44
|
-
json.
|
|
45
|
-
sha512.
|
|
46
|
-
base64.
|
|
47
|
-
upgrade.
|
|
48
|
-
sub.
|
|
1
|
+
substrate.4c780d6dd6d4@0+0
|
|
2
|
+
process.aea2c88cb7a0@0+0
|
|
3
|
+
path.dcc4712bcc7b@0+0
|
|
4
|
+
path.b7a8e1cf3aaa@0+0
|
|
5
|
+
fs.563034be70c3@0+0
|
|
6
|
+
common.91ddee6b7a67@0+0
|
|
7
|
+
grants.5bf25700d47c@0+0
|
|
8
|
+
writer.806bc85aa684@0+0
|
|
9
|
+
syntax.9857f6784d63@0+0
|
|
10
|
+
reader.b535e61f99f4@0+0
|
|
11
|
+
roots.6d2942578055@0+0
|
|
12
|
+
read.cd1e693f4fb4@0+0
|
|
13
|
+
manifest.cf7471880377@0+0
|
|
14
|
+
git.48aefa1644be@0+0
|
|
15
|
+
files.30e55182c5df@0+0
|
|
16
|
+
sha256.5fc9d60f8bb2@0+0
|
|
17
|
+
hash.3f0d118da63f@0+0
|
|
18
|
+
store.d4e845ff24ac@0+0
|
|
19
|
+
map.dc516eec27ff@0+0
|
|
20
|
+
env.f051f8166526@0+0
|
|
21
|
+
events.f952172735e0@0+0
|
|
22
|
+
build.84ac996eda63@0+0
|
|
23
|
+
pack.55992e8cc09c@0+0
|
|
24
|
+
site.7c6d8c7747af@0+0
|
|
25
|
+
site.81548474c323@0+0
|
|
26
|
+
fetch.097f1cc9502d@0+0
|
|
27
|
+
stream.4c07247477f7@0+0
|
|
28
|
+
worker.f1190de21b21@0+0
|
|
29
|
+
deflate.fc8075e3aed1@0+0
|
|
30
|
+
inflate.8899e0933792@0+0
|
|
31
|
+
gzip.69588e97c35a@0+0
|
|
32
|
+
tar.e482cf873cfc@0+0
|
|
33
|
+
fetch.5d2f427c995e@0+0
|
|
34
|
+
doc.566f9861828e@0+0
|
|
35
|
+
html.c1671a102b4d@0+0
|
|
36
|
+
html.20baa1dc7ca6@0+0
|
|
37
|
+
text.4ab70ac35b5a@0+0
|
|
38
|
+
root.9b713ec588c1@0+0
|
|
39
|
+
doc.0b48bbac404b@0+0
|
|
40
|
+
timer.3809bb17a7a1@0+0
|
|
41
|
+
chromium.e4db7d29897c@0+0
|
|
42
|
+
test.0d9c079bb309@0+0
|
|
43
|
+
utf8.524c475ecd40@0+0
|
|
44
|
+
json.f15a29d99d8d@0+0
|
|
45
|
+
sha512.b988b9dc6114@0+0
|
|
46
|
+
base64.8fba03e1be0a@0+0
|
|
47
|
+
upgrade.18a5aa0dae89@0+0
|
|
48
|
+
sub.b57e17b6876b@0+0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/std/crypto/sha256.sub
CHANGED
|
@@ -1,110 +1,4 @@
|
|
|
1
|
-
;; SHA-256 (FIPS 180-4), over bytes added in pieces or given at once.
|
|
2
|
-
(
|
|
1
|
+
;; SHA-256 (FIPS 180-4), over bytes added in pieces or given at once. It is defined in compiler/sha256.sub.
|
|
2
|
+
(require-unqualified sha256 compiler/sha256)
|
|
3
3
|
|
|
4
|
-
(
|
|
5
|
-
|
|
6
|
-
(define k (array u32 64)
|
|
7
|
-
(array-of u32 #x428a2f98 #x71374491 #xb5c0fbcf #xe9b5dba5 #x3956c25b #x59f111f1 #x923f82a4 #xab1c5ed5
|
|
8
|
-
#xd807aa98 #x12835b01 #x243185be #x550c7dc3 #x72be5d74 #x80deb1fe #x9bdc06a7 #xc19bf174
|
|
9
|
-
#xe49b69c1 #xefbe4786 #x0fc19dc6 #x240ca1cc #x2de92c6f #x4a7484aa #x5cb0a9dc #x76f988da
|
|
10
|
-
#x983e5152 #xa831c66d #xb00327c8 #xbf597fc7 #xc6e00bf3 #xd5a79147 #x06ca6351 #x14292967
|
|
11
|
-
#x27b70a85 #x2e1b2138 #x4d2c6dfc #x53380d13 #x650a7354 #x766a0abb #x81c2c92e #x92722c85
|
|
12
|
-
#xa2bfe8a1 #xa81a664b #xc24b8b70 #xc76c51a3 #xd192e819 #xd6990624 #xf40e3585 #x106aa070
|
|
13
|
-
#x19a4c116 #x1e376c08 #x2748774c #x34b0bcb5 #x391c0cb3 #x4ed8aa4a #x5b9cca4f #x682e6ff3
|
|
14
|
-
#x748f82ee #x78a5636f #x84c87814 #x8cc70208 #x90befffa #xa4506ceb #xbef9a3f7 #xc67178f2))
|
|
15
|
-
|
|
16
|
-
(define (rotr [x u32] [n u32]) #:inline -> u32 (bit-or (>> x n) (<< x (- 32 n))))
|
|
17
|
-
|
|
18
|
-
(define (word [p (ptr u8)]) #:inline -> u32
|
|
19
|
-
(bit-or (<< (cast u32 (@ p 0)) 24) (<< (cast u32 (@ p 1)) 16) (<< (cast u32 (@ p 2)) 8) (cast u32 (@ p 3))))
|
|
20
|
-
|
|
21
|
-
(define (compress! [s (ptr sha256)] [p (ptr u8)])
|
|
22
|
-
(let ([w (array u32 64)]
|
|
23
|
-
[a (@ (-> s state) 0)] [b (@ (-> s state) 1)] [c (@ (-> s state) 2)] [d (@ (-> s state) 3)]
|
|
24
|
-
[e (@ (-> s state) 4)] [f (@ (-> s state) 5)] [g (@ (-> s state) 6)] [hh (@ (-> s state) 7)])
|
|
25
|
-
(for ([i u32 0]) (< i 16) (+= i 1) (set! (@ w i) (word (+ p (* i 4)))))
|
|
26
|
-
(for ([i u32 16]) (< i 64) (+= i 1)
|
|
27
|
-
(let ([x (@ w (- i 15))] [y (@ w (- i 2))])
|
|
28
|
-
(set! (@ w i) (+ (@ w (- i 16)) (bit-xor (rotr x 7) (rotr x 18) (>> x 3)) (@ w (- i 7))
|
|
29
|
-
(bit-xor (rotr y 17) (rotr y 19) (>> y 10))))))
|
|
30
|
-
(for ([i u32 0]) (< i 64) (+= i 1)
|
|
31
|
-
(let* ([t1 (+ hh (bit-xor (rotr e 6) (rotr e 11) (rotr e 25)) (bit-xor (bit-and e f) (bit-and (bit-not e) g))
|
|
32
|
-
(@ k i) (@ w i))]
|
|
33
|
-
[t2 (+ (bit-xor (rotr a 2) (rotr a 13) (rotr a 22)) (bit-xor (bit-and a b) (bit-and a c) (bit-and b c)))])
|
|
34
|
-
(set! hh g)
|
|
35
|
-
(set! g f)
|
|
36
|
-
(set! f e)
|
|
37
|
-
(set! e (+ d t1))
|
|
38
|
-
(set! d c)
|
|
39
|
-
(set! c b)
|
|
40
|
-
(set! b a)
|
|
41
|
-
(set! a (+ t1 t2))))
|
|
42
|
-
(+= (@ (-> s state) 0) a)
|
|
43
|
-
(+= (@ (-> s state) 1) b)
|
|
44
|
-
(+= (@ (-> s state) 2) c)
|
|
45
|
-
(+= (@ (-> s state) 3) d)
|
|
46
|
-
(+= (@ (-> s state) 4) e)
|
|
47
|
-
(+= (@ (-> s state) 5) f)
|
|
48
|
-
(+= (@ (-> s state) 6) g)
|
|
49
|
-
(+= (@ (-> s state) 7) hh)))
|
|
50
|
-
|
|
51
|
-
(define (sha256-init! [s (ptr sha256)])
|
|
52
|
-
(set! (@ (-> s state) 0) #x6a09e667)
|
|
53
|
-
(set! (@ (-> s state) 1) #xbb67ae85)
|
|
54
|
-
(set! (@ (-> s state) 2) #x3c6ef372)
|
|
55
|
-
(set! (@ (-> s state) 3) #xa54ff53a)
|
|
56
|
-
(set! (@ (-> s state) 4) #x510e527f)
|
|
57
|
-
(set! (@ (-> s state) 5) #x9b05688c)
|
|
58
|
-
(set! (@ (-> s state) 6) #x1f83d9ab)
|
|
59
|
-
(set! (@ (-> s state) 7) #x5be0cd19)
|
|
60
|
-
(set! (-> s filled) 0)
|
|
61
|
-
(set! (-> s length) 0))
|
|
62
|
-
|
|
63
|
-
(define (sha256-add! [s (ptr sha256)] [b (slice u8)])
|
|
64
|
-
(let ([p (-> b items)] [n (-> b length)] [i u32 0])
|
|
65
|
-
(+= (-> s length) (cast u64 n))
|
|
66
|
-
(when (> (-> s filled) 0)
|
|
67
|
-
(while (and (< i n) (< (-> s filled) 64))
|
|
68
|
-
(set! (@ (-> s block) (-> s filled)) (@ p i))
|
|
69
|
-
(+= (-> s filled) 1)
|
|
70
|
-
(+= i 1))
|
|
71
|
-
(when (== (-> s filled) 64)
|
|
72
|
-
(compress! s (-> s block))
|
|
73
|
-
(set! (-> s filled) 0)))
|
|
74
|
-
(while (<= (+ i 64) n)
|
|
75
|
-
(compress! s (+ p i))
|
|
76
|
-
(+= i 64))
|
|
77
|
-
(while (< i n)
|
|
78
|
-
(set! (@ (-> s block) (-> s filled)) (@ p i))
|
|
79
|
-
(+= (-> s filled) 1)
|
|
80
|
-
(+= i 1))))
|
|
81
|
-
|
|
82
|
-
;; into takes the 32 bytes of the digest.
|
|
83
|
-
(define (sha256-end! [s (ptr sha256)] [into (slice u8)])
|
|
84
|
-
(let ([bits (* (-> s length) 8)])
|
|
85
|
-
(set! (@ (-> s block) (-> s filled)) 128)
|
|
86
|
-
(+= (-> s filled) 1)
|
|
87
|
-
(when (> (-> s filled) 56)
|
|
88
|
-
(while (< (-> s filled) 64)
|
|
89
|
-
(set! (@ (-> s block) (-> s filled)) 0)
|
|
90
|
-
(+= (-> s filled) 1))
|
|
91
|
-
(compress! s (-> s block))
|
|
92
|
-
(set! (-> s filled) 0))
|
|
93
|
-
(while (< (-> s filled) 56)
|
|
94
|
-
(set! (@ (-> s block) (-> s filled)) 0)
|
|
95
|
-
(+= (-> s filled) 1))
|
|
96
|
-
(for ([i u32 0]) (< i 8) (+= i 1)
|
|
97
|
-
(set! (@ (-> s block) (+ 56 i)) (cast u8 (>> bits (* 8 (- 7 i))))))
|
|
98
|
-
(compress! s (-> s block))
|
|
99
|
-
(for ([i u32 0]) (< i 8) (+= i 1)
|
|
100
|
-
(let ([h (@ (-> s state) i)])
|
|
101
|
-
(set! (@ into (* i 4)) (cast u8 (>> h 24)))
|
|
102
|
-
(set! (@ into (+ (* i 4) 1)) (cast u8 (>> h 16)))
|
|
103
|
-
(set! (@ into (+ (* i 4) 2)) (cast u8 (>> h 8)))
|
|
104
|
-
(set! (@ into (+ (* i 4) 3)) (cast u8 h))))))
|
|
105
|
-
|
|
106
|
-
(define (sha256-of [b (slice u8)] [into (slice u8)])
|
|
107
|
-
(let ([s sha256])
|
|
108
|
-
(sha256-init! (& s))
|
|
109
|
-
(sha256-add! (& s) b)
|
|
110
|
-
(sha256-end! (& s) into)))
|
|
4
|
+
(provide (all-from-out sha256))
|
package/std/test/session.sub
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
(define (run-session [file string])
|
|
21
21
|
(let ([map (string->datum (setting "SUBSTRATE_MODULE_MAP"))])
|
|
22
22
|
(set-toolchain-directory! (string->datum (setting "SUBSTRATE_TOOLCHAIN")))
|
|
23
|
-
(install-core!)
|
|
24
23
|
(set-module-map-text! (file-text map) map)
|
|
25
24
|
(set-cache-directory! (string->datum (setting "SUBSTRATE_CACHE")))
|
|
26
25
|
(set-display-directory! (string->datum (parent-of file)))
|
package/substrate/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.3
|
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
[_ #f]))
|
|
350
350
|
|
|
351
351
|
(define (scalar! [t datum] [where datum]) -> datum
|
|
352
|
-
(unless (or (arithmetic? t) (address-type? t) (== t 'exnref) (== t 'bool) (view-type? t))
|
|
352
|
+
(unless (or (arithmetic? t) (address-type? t) (== t 'exnref) (== t 'bool) (view-type? t) (and (pair? t) (== (car t) 'tvar)))
|
|
353
353
|
(substrate-error where "expected a number or pointer type, not ~s" `(,(shown t))))
|
|
354
354
|
t)
|
|
355
355
|
|