mirror of
https://github.com/urbit/shrub.git
synced 2024-12-13 06:25:09 +03:00
AES toys
This commit is contained in:
parent
b3b2c56603
commit
a1e460cba2
@ -187,7 +187,7 @@
|
||||
0
|
||||
(rap 7 (bren key (mix i haf)) $(i +(i)) ~)
|
||||
++ en
|
||||
|+ [key=@I msg=@]
|
||||
|+ [key=@I msg=@] ^- @uv
|
||||
=+ len=(met 7 msg)
|
||||
=+ adj=?:(=(0 len) 1 len)
|
||||
=+ hax=(shax (mix key (shax (mix adj msg))))
|
||||
@ -195,7 +195,7 @@
|
||||
=+ ret=(can 7 ~[[2 hax] [adj (mix (burn key haf adj) msg)]])
|
||||
ret
|
||||
++ de
|
||||
|+ [key=@I cep=@] ^- (unit ,@)
|
||||
|+ [key=@I cep=@] ^- (unit ,@uv)
|
||||
=+ toh=(met 7 cep)
|
||||
?: (lth toh 3)
|
||||
~
|
||||
|
@ -1,20 +0,0 @@
|
||||
!:
|
||||
:: /=try=/bin/aes/hoon
|
||||
::
|
||||
=> %= .
|
||||
+
|
||||
=> +
|
||||
^/=main=/lib/cryo
|
||||
==
|
||||
|= *
|
||||
|= ~
|
||||
^- bowl
|
||||
=+ k=0x1f1e.1d1c.1b1a.1918.1716.1514.1312.1110.0f0e.0d0c.0b0a.0908.0706.0504.0302.0100
|
||||
=+ m=0xffee.ddcc.bbaa.9988.7766.5544.3322.1100
|
||||
=+ e=(en:aes k m)
|
||||
:_ ~ :_ ~
|
||||
:- %$
|
||||
=+ o=(en:aes 2 1)
|
||||
=+ d=(de:aes 2 o)
|
||||
!>
|
||||
[`@ux`e `@ux`(de:aes k e) `@ux`o `@ux`d]
|
17
try/bin/aesde.hoon
Normal file
17
try/bin/aesde.hoon
Normal file
@ -0,0 +1,17 @@
|
||||
!:
|
||||
:: /=try=/bin/aesde/hoon
|
||||
::
|
||||
:: AES decryption toy. Don't use this for anything real.
|
||||
::
|
||||
=> %= .
|
||||
+
|
||||
=> +
|
||||
^/=main=/lib/cryo
|
||||
==
|
||||
|= *
|
||||
|= [k=@I c=@ ~]
|
||||
^- bowl
|
||||
=+ m=(de:aes k c)
|
||||
:_ ~ :_ ~
|
||||
:- %$
|
||||
!> m
|
17
try/bin/aesen.hoon
Normal file
17
try/bin/aesen.hoon
Normal file
@ -0,0 +1,17 @@
|
||||
!:
|
||||
:: /=try=/bin/aesen/hoon
|
||||
::
|
||||
:: AES encryption toy. Don't use this for anything real.
|
||||
::
|
||||
=> %= .
|
||||
+
|
||||
=> +
|
||||
^/=main=/lib/cryo
|
||||
==
|
||||
|= *
|
||||
|= [k=@I m=@ ~]
|
||||
^- bowl
|
||||
=+ c=(en:aes k m)
|
||||
:_ ~ :_ ~
|
||||
:- %$
|
||||
!> c
|
Loading…
Reference in New Issue
Block a user