mirror of
https://github.com/urbit/shrub.git
synced 2024-12-13 06:25:09 +03:00
Add base58 functions to zuse
This commit is contained in:
parent
4a6e71832f
commit
e715445c98
@ -5032,6 +5032,28 @@
|
||||
(cold 62 (just '+'))
|
||||
(cold 63 (just '/'))
|
||||
==
|
||||
::
|
||||
++ en-base58
|
||||
|= dat=@
|
||||
=/ cha
|
||||
'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
||||
%- flop
|
||||
|- ^- tape
|
||||
?: =(0 dat) ~
|
||||
:- (cut 3 [(mod dat 58) 1] cha)
|
||||
$(dat (div dat 58))
|
||||
::
|
||||
++ de-base58
|
||||
|= t=tape
|
||||
=- (scan t (bass 58 (plus -)))
|
||||
;~ pose
|
||||
(cook |=(a=@ (sub a 56)) (shim 'A' 'H'))
|
||||
(cook |=(a=@ (sub a 57)) (shim 'J' 'N'))
|
||||
(cook |=(a=@ (sub a 58)) (shim 'P' 'Z'))
|
||||
(cook |=(a=@ (sub a 64)) (shim 'a' 'k'))
|
||||
(cook |=(a=@ (sub a 65)) (shim 'm' 'z'))
|
||||
(cook |=(a=@ (sub a 49)) (shim '1' '9'))
|
||||
==
|
||||
-- ::mimes
|
||||
:: :: ++en-json:html
|
||||
++ en-json :: print json
|
||||
|
Loading…
Reference in New Issue
Block a user