diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 9b809933b..0e2f79efa 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -3810,6 +3810,7 @@ -- :: ++ ob + ~% %ob + ~ |% :: +fein: conceal structure, v3. :: @@ -3817,6 +3818,7 @@ :: trivial to tell which planet a star has spawned under. :: ++ fein + ~/ %fein |= pyn/@ ^- @ ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff)) (add 0x1.0000 (feis (sub pyn 0x1.0000))) @@ -3832,6 +3834,7 @@ :: Restores obfuscated values that have been enciphered with +fein. :: ++ fynd + ~/ %fynd |= cry/@ ^- @ ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff)) (add 0x1.0000 (tail (sub cry 0x1.0000))) @@ -3848,6 +3851,7 @@ :: See: Black & Rogaway (2002), Ciphers for arbitrary finite domains. :: ++ feis + ~/ %feis |= m=@ ^- @ (fee 4 0xffff 0x1.0000 (mul 0xffff 0x1.0000) eff m) @@ -3855,6 +3859,7 @@ :: +tail: reverse +feis. :: ++ tail + ~/ %tail |= m=@ ^- @ (feen 4 0xffff 0x1.0000 (mul 0xffff 0x1.0000) eff m) @@ -3871,6 +3876,7 @@ :: m: an input value in the domain [0, k - 1] :: ++ fee + ~/ %fee |= [r=@ a=@ b=@ k=@ prf=$-([j=@ r=@] @) m=@] ^- @ =/ c (fe r a b prf m) @@ -3884,6 +3890,7 @@ :: +fee. :: ++ feen + ~/ %feen |= [r=@ a=@ b=@ k=@ prf=$-([j=@ r=@] @) m=@] ^- @ =/ c (fen r a b prf m) @@ -3899,6 +3906,7 @@ :: to support some legacy behaviour. See urbit/arvo#1105. :: ++ fe + ~/ %fe |= [r=@ a=@ b=@ prf=$-([j=@ r=@] @) m=@] =/ j 1 =/ ell (mod m a) @@ -3937,6 +3945,7 @@ :: to support some legacy behaviour. See urbit/arvo#1105. :: ++ fen + ~/ %fen |= [r=@ a=@ b=@ prf=$-([j=@ r=@] @) m=@] =/ j r :: @@ -3985,6 +3994,7 @@ :: +eff: a murmur3-based pseudorandom function. 'F' in B&R (2002). :: ++ eff + ~/ %eff |= [j=@ r=@] ^- @ (muk (snag j raku) 2 r) diff --git a/pkg/urbit/include/jets/w.h b/pkg/urbit/include/jets/w.h index 439c0be82..33c1610ce 100644 --- a/pkg/urbit/include/jets/w.h +++ b/pkg/urbit/include/jets/w.h @@ -76,6 +76,8 @@ u3_noun u3wcp_tos(u3_noun); u3_noun u3wcp_tod(u3_noun); + u3_noun u3wc_ob_eff(u3_noun); + /** Tier 4. **/ u3_noun u3wdb_bif(u3_noun); diff --git a/pkg/urbit/jets/c/ob.c b/pkg/urbit/jets/c/ob.c new file mode 100644 index 000000000..539340616 --- /dev/null +++ b/pkg/urbit/jets/c/ob.c @@ -0,0 +1,48 @@ +/* j/3/ob.c +** +*/ +#include "all.h" + +u3_noun +u3qc_ob_eff(u3_atom j, u3_atom r) +{ + c3_d found = 0; + switch (j) { + case 0: + found = 0xb76d5eed; + break; + case 1: + found = 0xee281300; + break; + case 2: + found = 0x85bcae01; + break; + case 3: + found = 0x4b387af7; + break; + default: + // the internal snag would have failed. + return u3m_bail(c3__exit); + } + + return u3qc_muk(u3i_chubs(1, &found), 2, r); +} + +u3_noun +u3wc_ob_eff(u3_noun cor) +{ + u3_noun j, r; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &j, + u3x_sam_3, &r, 0)) || + (c3n == u3ud(j)) || + (c3n == u3ud(r)) ) + { + fprintf(stderr, "u3wc_ob_eff failed to unpack\r\n"); + return u3m_bail(c3__exit); + } + else { + return u3qc_ob_eff(j, r); + } +} + diff --git a/pkg/urbit/jets/e/slaw.c b/pkg/urbit/jets/e/slaw.c index f27436ccd..52cdfe690 100644 --- a/pkg/urbit/jets/e/slaw.c +++ b/pkg/urbit/jets/e/slaw.c @@ -49,6 +49,18 @@ return u3nc(0, total); } + // parsing @p: + // + // +slaw calls +fed:ag directly. +fed:ag: + // + // - parses the text first into a number. + // - runs fynd:ob, which is the scrambler restore structure. And +fynd is + // unjetted. + // + // The actual +po stuff, like +ins:po, is jetted but it's jetted such that it + // pulls the tables out of the sample, so we can't just reuse it from other + // jets. + u3_noun _parse_tas(u3_noun txt) { // For any symbol which matches, txt will return itself as a diff --git a/pkg/urbit/jets/tree.c b/pkg/urbit/jets/tree.c index 75b8fc0e8..d3a3cac03 100644 --- a/pkg/urbit/jets/tree.c +++ b/pkg/urbit/jets/tree.c @@ -923,6 +923,14 @@ static c3_c* _141_tri__cofl_ha[] = { 0 }; + +static u3j_harm _141_tri__ob_eff_a[] = {{".2", u3wc_ob_eff}, {}}; +static u3j_core _141_tri__ob_d[] = + { { "eff", 7, _141_tri__ob_eff_a, 0, 0 }, + {} + }; + + static u3j_harm _141_tri__rd_add_a[] = {{".2", u3wer_add}, {}}; static c3_c* _141_tri__rd_add_ha[] = { "90dfaaadb2878d6d89a808ce4199e5bb239fa981e1c2edf24dc54aa3fcab55a5", @@ -1270,6 +1278,7 @@ static c3_c* _141_tri_shal_ha[] = { static u3j_core _141_tri_d[] = { { "qua", 3, 0, _141_qua_d, _141_qua_ha, _141_qua_ho }, + { "ob", 3, 0, _141_tri__ob_d, 0 }, { "cofl", 7, 0, _141_tri__cofl_d, _141_tri__cofl_ha }, { "rd", 7, 0, _141_tri__rd_d, _141_tri__rd_ha }, { "rs", 7, 0, _141_tri__rs_d, _141_tri__rs_ha }, @@ -1282,6 +1291,7 @@ static u3j_core _141_tri_d[] = { "shay", 7, _141_tri_shay_a, 0, _141_tri_shay_ha }, { "shas", 7, _141_tri_shas_a, 0, _141_tri_shas_ha }, { "shal", 7, _141_tri_shal_a, 0, _141_tri_shal_ha }, + {} }; static c3_c* _141_tri_ha[] = {