mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 03:00:15 +03:00
BTC base58check @uc odour v1
This commit is contained in:
parent
479311153d
commit
34431f53e9
1
i/j/q.h
1
i/j/q.h
@ -94,6 +94,7 @@
|
||||
u3_noun u3qea_en(u3_atom, u3_atom);
|
||||
|
||||
u3_noun u3qe_shax(u3_atom);
|
||||
u3_noun u3qe_shay(u3_atom, u3_atom);
|
||||
u3_noun u3qe_shas(u3_atom, u3_atom);
|
||||
u3_noun u3qe_shal(u3_atom, u3_atom);
|
||||
|
||||
|
1
i/j/w.h
1
i/j/w.h
@ -106,6 +106,7 @@
|
||||
u3_noun u3wea_en(u3_noun);
|
||||
|
||||
u3_noun u3we_shax(u3_noun);
|
||||
u3_noun u3we_shay(u3_noun);
|
||||
u3_noun u3we_shas(u3_noun);
|
||||
u3_noun u3we_shal(u3_noun);
|
||||
|
||||
|
61
j/e/shax.c
61
j/e/shax.c
@ -12,7 +12,44 @@
|
||||
|
||||
/* functions
|
||||
*/
|
||||
|
||||
u3_noun
|
||||
u3qe_shay(u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
c3_assert(_(u3a_is_cat(a)));
|
||||
c3_y* fat_y = c3_malloc(a + 1);
|
||||
|
||||
u3r_bytes(0, a, fat_y, b);
|
||||
{
|
||||
c3_y dig_y[32];
|
||||
#if defined(U3_OS_osx)
|
||||
CC_SHA256_CTX ctx_h;
|
||||
|
||||
CC_SHA256_Init(&ctx_h);
|
||||
CC_SHA256_Update(&ctx_h, fat_y, a);
|
||||
CC_SHA256_Final(dig_y, &ctx_h);
|
||||
#else
|
||||
SHA256_CTX ctx_h;
|
||||
|
||||
SHA256_Init(&ctx_h);
|
||||
SHA256_Update(&ctx_h, fat_y, a);
|
||||
SHA256_Final(dig_y, &ctx_h);
|
||||
#endif
|
||||
free(fat_y);
|
||||
return u3i_bytes(32, dig_y);
|
||||
}
|
||||
}
|
||||
|
||||
// u3_noun
|
||||
// u3qe_shax(
|
||||
// u3_atom a)
|
||||
// {
|
||||
// c3_w met_w = u3r_met(3, a);
|
||||
// return u3qe_shay(met_w, a);
|
||||
// }
|
||||
// XX preformance
|
||||
u3_noun
|
||||
u3qe_shax(
|
||||
u3_atom a)
|
||||
{
|
||||
@ -40,6 +77,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
// XX end preformance
|
||||
|
||||
u3_noun
|
||||
u3qe_shal(u3_atom a,
|
||||
u3_atom b)
|
||||
@ -95,6 +134,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3we_shay(u3_noun cor)
|
||||
{
|
||||
u3_noun a, b;
|
||||
|
||||
// static int few = 0;
|
||||
// if(few == 0) printf("foo\r\n");
|
||||
// few++; few %= 1000;
|
||||
|
||||
|
||||
if ( (u3_none == (a = u3r_at(u3x_sam_2, cor))) ||
|
||||
(u3_none == (b = u3r_at(u3x_sam_3, cor))) ||
|
||||
(c3n == u3ud(a)) ||
|
||||
(c3n == u3a_is_cat(a)) ||
|
||||
(c3n == u3ud(b)) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
return u3qe_shay(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3we_shal(u3_noun cor)
|
||||
{
|
||||
|
2
j/tree.c
2
j/tree.c
@ -236,6 +236,7 @@ static u3j_harm _mood__hoon_plug_a[] = {{".2", u3we_plug}, {}};
|
||||
static u3j_harm _mood__hoon_pose_a[] = {{".2", u3we_pose}, {}};
|
||||
static u3j_harm _mood__hoon_sfix_a[] = {{".2", u3we_sfix}, {}};
|
||||
static u3j_harm _mood__hoon_shax_a[] = {{".2", u3we_shax}, {}};
|
||||
static u3j_harm _mood__hoon_shay_a[] = {{".2", u3we_shay}, {}};
|
||||
static u3j_harm _mood__hoon_shas_a[] = {{".2", u3we_shas}, {}};
|
||||
static u3j_harm _mood__hoon_shal_a[] = {{".2", u3we_shal}, {}};
|
||||
|
||||
@ -454,6 +455,7 @@ static u3j_core _mood__hoon_d[] =
|
||||
{ "sfix", _mood__hoon_sfix_a },
|
||||
|
||||
{ "shax", _mood__hoon_shax_a },
|
||||
{ "shay", _mood__hoon_shay_a },
|
||||
{ "shas", _mood__hoon_shas_a },
|
||||
{ "shal", _mood__hoon_shal_a },
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user