From a1e460cba293e631f9bcbde698058e6f0923976d Mon Sep 17 00:00:00 2001 From: Steven Dee Date: Thu, 30 Jan 2014 11:01:55 -0800 Subject: [PATCH] AES toys --- main/lib/cryo.hoon | 4 ++-- try/bin/aes.hoon | 20 -------------------- try/bin/aesde.hoon | 17 +++++++++++++++++ try/bin/aesen.hoon | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 22 deletions(-) delete mode 100644 try/bin/aes.hoon create mode 100644 try/bin/aesde.hoon create mode 100644 try/bin/aesen.hoon diff --git a/main/lib/cryo.hoon b/main/lib/cryo.hoon index f6509f2881..b9633d430c 100644 --- a/main/lib/cryo.hoon +++ b/main/lib/cryo.hoon @@ -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) ~ diff --git a/try/bin/aes.hoon b/try/bin/aes.hoon deleted file mode 100644 index fd97694238..0000000000 --- a/try/bin/aes.hoon +++ /dev/null @@ -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] diff --git a/try/bin/aesde.hoon b/try/bin/aesde.hoon new file mode 100644 index 0000000000..16c79b35a5 --- /dev/null +++ b/try/bin/aesde.hoon @@ -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 diff --git a/try/bin/aesen.hoon b/try/bin/aesen.hoon new file mode 100644 index 0000000000..7fd20f5ae3 --- /dev/null +++ b/try/bin/aesen.hoon @@ -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