shrub/try/bin/ed.hoon

33 lines
595 B
Plaintext
Raw Normal View History

2014-01-23 08:40:43 +04:00
!:
:: /=try=/bin/ed/hoon
::
2014-01-24 00:31:12 +04:00
:: ed25519 as a toy in Hoon.
::
:: 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.
2014-01-23 08:40:43 +04:00
::
=> %= .
+
=> +
2014-01-24 02:12:11 +04:00
^/=main=/lib/cryo
2014-01-23 08:40:43 +04:00
==
|= [est=time eny=@uw]
2014-01-24 00:26:02 +04:00
|= [sk=@ m=@ ~]
2014-01-23 08:40:43 +04:00
^- bowl
2014-01-24 02:12:11 +04:00
=+ pk=(puck:ed sk)
2014-01-23 08:40:43 +04:00
~& [%pk `@ux`pk]
2014-01-24 02:12:11 +04:00
=+ si=(sign:ed m sk pk)
2014-01-23 08:40:43 +04:00
~& [%si `@ux`si]
:_ ~ :_ ~
:- %$
!>
2014-01-23 23:22:41 +04:00
=+ ^= sis
2014-01-24 02:12:11 +04:00
?: (veri:ed si m pk)
2014-01-23 08:40:43 +04:00
'valid sig'
'invalid sig'
2014-01-23 23:22:41 +04:00
=+ ^= fos
2014-01-24 02:12:11 +04:00
?. (veri:ed si +(m) pk)
2014-01-23 23:22:41 +04:00
'detected forgery'
'undetected forgery'
[sis fos]