mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
Splinter out ed toys
This commit is contained in:
parent
6e34c98472
commit
bc3145d706
20
try/bin/edpk.hoon
Normal file
20
try/bin/edpk.hoon
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
!:
|
||||||
|
:: /=try=/bin/edpk/hoon
|
||||||
|
::
|
||||||
|
:: ed25519 public key toy.
|
||||||
|
::
|
||||||
|
:: Needless to say, don't use this for anything real. Not only will it be
|
||||||
|
:: embarrassingly slow, but it'll probably mail your private key to the NSA.
|
||||||
|
::
|
||||||
|
=> %= .
|
||||||
|
+
|
||||||
|
=> +
|
||||||
|
^/=main=/lib/cryo
|
||||||
|
==
|
||||||
|
|= [est=time eny=@uw]
|
||||||
|
|= [sk=@ ~]
|
||||||
|
^- bowl
|
||||||
|
=+ pk=(puck:ed sk)
|
||||||
|
:_ ~ :_ ~
|
||||||
|
:- %$
|
||||||
|
!> `@ux`pk
|
@ -1,7 +1,7 @@
|
|||||||
!:
|
!:
|
||||||
:: /=try=/bin/ed/hoon
|
:: /=try=/bin/ed/hoon
|
||||||
::
|
::
|
||||||
:: ed25519 as a toy in Hoon.
|
:: ed25519 signature toy.
|
||||||
::
|
::
|
||||||
:: Needless to say, don't use this for anything real. Not only will it be
|
:: Needless to say, don't use this for anything real. Not only will it be
|
||||||
:: embarrassingly slow, but it'll probably mail your private key to the NSA.
|
:: embarrassingly slow, but it'll probably mail your private key to the NSA.
|
||||||
@ -12,21 +12,9 @@
|
|||||||
^/=main=/lib/cryo
|
^/=main=/lib/cryo
|
||||||
==
|
==
|
||||||
|= [est=time eny=@uw]
|
|= [est=time eny=@uw]
|
||||||
|= [sk=@ m=@ ~]
|
|= [sk=@ pk=@ m=@ ~]
|
||||||
^- bowl
|
^- bowl
|
||||||
=+ pk=(puck:ed sk)
|
|
||||||
~& [%pk `@ux`pk]
|
|
||||||
=+ si=(sign:ed m sk pk)
|
=+ si=(sign:ed m sk pk)
|
||||||
~& [%si `@ux`si]
|
|
||||||
:_ ~ :_ ~
|
:_ ~ :_ ~
|
||||||
:- %$
|
:- %$
|
||||||
!>
|
!> `@ux`si
|
||||||
=+ ^= sis
|
|
||||||
?: (veri:ed si m pk)
|
|
||||||
'valid sig'
|
|
||||||
'invalid sig'
|
|
||||||
=+ ^= fos
|
|
||||||
?. (veri:ed si +(m) pk)
|
|
||||||
'detected forgery'
|
|
||||||
'undetected forgery'
|
|
||||||
[sis fos]
|
|
18
try/bin/edve.hoon
Normal file
18
try/bin/edve.hoon
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
!:
|
||||||
|
:: /=try=/bin/edpk/hoon
|
||||||
|
::
|
||||||
|
:: ed25519 signature verification toy.
|
||||||
|
::
|
||||||
|
=> %= .
|
||||||
|
+
|
||||||
|
=> +
|
||||||
|
^/=main=/lib/cryo
|
||||||
|
==
|
||||||
|
|= [est=time eny=@uw]
|
||||||
|
|= [pk=@ s=@ m=@ ~]
|
||||||
|
^- bowl
|
||||||
|
:_ ~ :_ ~
|
||||||
|
:- %$
|
||||||
|
!> ?: (veri:ed s m pk)
|
||||||
|
'valid sig'
|
||||||
|
'invalid sig'
|
11
try/bin/gen.hoon
Normal file
11
try/bin/gen.hoon
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
!:
|
||||||
|
:: /=try=/bin/gen/hoon
|
||||||
|
::
|
||||||
|
:: produce 256 bits of entropy.
|
||||||
|
::
|
||||||
|
|= [est=time eny=@uw]
|
||||||
|
|= ~
|
||||||
|
^- bowl
|
||||||
|
:_ ~ :_ ~
|
||||||
|
:- %$
|
||||||
|
!> `@ux`(cut 3 [0 32] (shaz eny))
|
Loading…
Reference in New Issue
Block a user