on master help sign in
thru 3d
commit6756d141f09f185400428ecf7ed2978902df32c4 authorHenry Ault <henry@tlon.io> dateFri 18 Mar 2016, 10:21 (11 years ago) parentc6bbffa
11 files changed+24−103
docs/system/hoon/library/src/3d/core/og.md+6−6 docs/system/hoon/library/src/3d/gate/shad.md+2−1 docs/system/hoon/library/src/3d/gate/shaf.md+1−1 docs/system/hoon/library/src/3d/gate/shak.md+1−1 docs/system/hoon/library/src/3d/gate/shal.md+2−2 docs/system/hoon/library/src/3d/gate/sham.md+1−1 docs/system/hoon/library/src/3d/gate/shan.md+3−2 docs/system/hoon/library/src/3d/gate/shas.md+1−1 docs/system/hoon/library/src/3d/gate/shaw.md+1−1 docs/system/hoon/library/src/3d/gate/shax.md+5−86 docs/system/hoon/library/src/3d/gate/shaz.md+1−1
docs/system/hoon/library/src/3d/core/og.md+6−6
@@ -3,14 +3,14 @@
33
44 ++ og :: shax-powered rng
55 ~/ %og
6− |_ a=@
6+ |_ a/@
77
88XX document
99
1010### `++rad`
1111
1212 ++ rad :: random in range
13− |= b=@ ^- @
13+ |= b/@ ^- @
1414 =+ c=(raw (met 0 b))
1515 ?:((lth c b) c $(a +(a)))
1616 ::
@@ -20,7 +20,7 @@ XX document
2020### `++rads`
2121
2222 ++ rads :: random continuation
23− |= b=@
23+ |= b/@
2424 =+ r=(rad b)
2525 [r +>.$(a (shas %og-s r))]
2626
@@ -30,11 +30,11 @@ XX document
3030
3131 ++ raw :: random bits
3232 ~/ %raw
33− |= b=@ ^- @
33+ |= b/@ ^- @
3434 %+ can
3535 0
3636 =+ c=(shas %og-a (mix b a))
37− |- ^- (list ,[@ @])
37+ |- ^- (list [@ @])
3838 ?: =(0 b)
3939 ~
4040 =+ d=(shas %og-b (mix b (mix a c)))
@@ -47,7 +47,7 @@ XX document
4747### `++raws`
4848
4949 ++ raws :: random bits continuation
50− |= b=@
50+ |= b/@
5151 =+ r=(raw b)
5252 [r +>.$(a (shas %og-s r))]
5353 --
docs/system/hoon/library/src/3d/gate/shad.md+2−1
@@ -1,6 +1,7 @@
11### `++shad`
22
3− ++ shad |=(ruz=@ (shax (shax ruz))) :: double sha-256
3+ ++ shad |=(ruz/@ (shax (shax ruz))) :: double sha-256
4+
45
56XX document
67
docs/system/hoon/library/src/3d/gate/shaf.md+1−1
@@ -1,7 +1,7 @@
11### `++shaf`
22
33 ++ shaf :: half sha-256
4− |= [sal=@ ruz=@]
4+ |= [sal/@ ruz/@]
55 =+ haz=(shas sal ruz)
66 (mix (end 7 1 haz) (rsh 7 1 haz))
77 ::
docs/system/hoon/library/src/3d/gate/shak.md+1−1
@@ -1,7 +1,7 @@
11### `++shak`
22
33 ++ shak :: XX shd be PBKDF
4− |= [who=@p wud=@]
4+ |= [who/@p wud/@]
55 (shas (mix %shak who) wud)
66 ::
77
docs/system/hoon/library/src/3d/gate/shal.md+2−2
@@ -2,9 +2,9 @@
22
33 ++ shal :: sha-512 with length
44 ~/ %shal
5− |= [len=@ ruz=@] ^- @
5+ |= {len/@ ruz/@} ^- @
66 => .(ruz (cut 3 [0 len] ruz))
7− =+ [few==>(fe .(a 6)) wac=|=([a=@ b=@] (cut 6 [a 1] b))]
7+ =+ [few==>(fe .(a 6)) wac=|=({a/@ b/@} (cut 6 [a 1] b))]
88 =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
99 =+ ral=(lsh 0 3 len)
1010 =+ ^= ful
docs/system/hoon/library/src/3d/gate/sham.md+1−1
@@ -1,7 +1,7 @@
11### `++sham`
22
33 ++ sham :: noun hash
4− |= yux=* ^- @uvH ^- @
4+ |= yux/* ^- @uvH ^- @
55 ?@ yux
66 (shaf %mash yux)
77 (shaf %sham (jam yux))
docs/system/hoon/library/src/3d/gate/shan.md+3−2
@@ -1,8 +1,8 @@
11### `++shan`
22
33 ++ shan :: sha-1 (deprecated)
4− |= ruz=@
5− =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
4+ |= ruz/@
5+ =+ [few==>(fe .(a 5)) wac=|=({a/@ b/@} (cut 5 [a 1] b))]
66 =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
77 =+ ral=(lsh 0 3 (met 3 ruz))
88 =+ ^= ful
@@ -65,6 +65,7 @@
6565 :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
6666 :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
6767 $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
68+ ::
6869
6970XX document
7071
docs/system/hoon/library/src/3d/gate/shas.md+1−1
@@ -1,7 +1,7 @@
11### `++shas`
22
33 ++ shas :: salted hash
4− |= [sal=@ ruz=@]
4+ |= [sal/@ ruz/@]
55 (shax (mix sal (shax ruz)))
66 ::
77
docs/system/hoon/library/src/3d/gate/shaw.md+1−1
@@ -1,7 +1,7 @@
11### `++shaw`
22
33 ++ shaw :: hash to nbits
4− |= [sal=@ len=@ ruz=@]
4+ |= [sal/@ len/@ ruz/@]
55 (~(raw og (shas sal (mix len ruz))) len)
66 ::
77
docs/system/hoon/library/src/3d/gate/shax.md+5−86
@@ -1,91 +1,10 @@
11### `++shax`
22
3− ++ shax :: sha-256
4− ~/ %shax
5− |= ruz=@ ^- @
6− ~| %sha
7− =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
8− =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
9− =+ ral=(lsh 0 3 (met 3 ruz))
10− =+ ^= ful
11− %+ can 0
12− :~ [ral ruz]
13− [8 128]
14− [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
15− [64 (~(net fe 6) ral)]
16− ==
17− =+ lex=(met 9 ful)
18− =+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa.
19− 8cc7.0208.84c8.7814.78a5.636f.748f.82ee.
20− 682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3.
21− 34b0.bcb5.2748.774c.1e37.6c08.19a4.c116.
22− 106a.a070.f40e.3585.d699.0624.d192.e819.
23− c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1.
24− 9272.2c85.81c2.c92e.766a.0abb.650a.7354.
25− 5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85.
26− 1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3.
27− bf59.7fc7.b003.27c8.a831.c66d.983e.5152.
28− 76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f.
29− 240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1.
30− c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74.
31− 550c.7dc3.2431.85be.1283.5b01.d807.aa98.
32− ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b.
33− e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98
34− =+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f.
35− a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667
36− =+ i=0
37− |- ^- @
38− ?: =(i lex)
39− (rep 5 (turn (rip 5 hax) net))
40− =+ ^= wox
41− =+ dux=(cut 9 [i 1] ful)
42− =+ wox=(rep 5 (turn (rip 5 dux) net))
43− =+ j=16
44− |- ^- @
45− ?: =(64 j)
46− wox
47− =+ :* l=(wac (sub j 15) wox)
48− m=(wac (sub j 2) wox)
49− n=(wac (sub j 16) wox)
50− o=(wac (sub j 7) wox)
51− ==
52− =+ x=:(mix (ror 0 7 l) (ror 0 18 l) (rsh 0 3 l))
53− =+ y=:(mix (ror 0 17 m) (ror 0 19 m) (rsh 0 10 m))
54− =+ z=:(sum n x o y)
55− $(wox (con (lsh 5 j z) wox), j +(j))
56− =+ j=0
57− =+ :* a=(wac 0 hax)
58− b=(wac 1 hax)
59− c=(wac 2 hax)
60− d=(wac 3 hax)
61− e=(wac 4 hax)
62− f=(wac 5 hax)
63− g=(wac 6 hax)
64− h=(wac 7 hax)
65− ==
66− |- ^- @
67− ?: =(64 j)
68− %= ^$
69− i +(i)
70− hax %+ rep 5
71− :~ (sum a (wac 0 hax))
72− (sum b (wac 1 hax))
73− (sum c (wac 2 hax))
74− (sum d (wac 3 hax))
75− (sum e (wac 4 hax))
76− (sum f (wac 5 hax))
77− (sum g (wac 6 hax))
78− (sum h (wac 7 hax))
79− ==
80− ==
81− =+ l=:(mix (ror 0 2 a) (ror 0 13 a) (ror 0 22 a)) :: s0
82− =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
83− =+ n=(sum l m) :: t2
84− =+ o=:(mix (ror 0 6 e) (ror 0 11 e) (ror 0 25 e)) :: s1
85− =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
86− =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
87− $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
88− ::
3+++ shax :: sha-256
4+ ~/ %shax
5+ |= ruz/@ ^- @
6+ (shay [(met 3 ruz) ruz])
7+::
898
909XX document
9110
docs/system/hoon/library/src/3d/gate/shaz.md+1−1
@@ -1,7 +1,7 @@
11### `++shaz`
22
33 ++ shaz :: sha-512
4− |= ruz=@ ^- @
4+ |= ruz/@ ^- @
55 (shal [(met 3 ruz) ruz])
66
77