Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
30
Task/Chaocipher/Tailspin/chaocipher.tailspin
Normal file
30
Task/Chaocipher/Tailspin/chaocipher.tailspin
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
templates chaocipher&{left:,right:,decode:}
|
||||
templates permute
|
||||
def ctshift: [ $@chaocipher.ct($..last)..., $@chaocipher.ct(1..$-1)...];
|
||||
def p1: $ mod 26 + 1;
|
||||
def ptshift: [ $@chaocipher.pt($p1..last)..., $@chaocipher.pt(1..$p1-1)...];
|
||||
..|@chaocipher: { ct: [ $ctshift(1), $ctshift(3..14)..., $ctshift(2), $ctshift(15..last)...],
|
||||
pt: [ $ptshift(1..2)..., $ptshift(4..14)..., $ptshift(3), $ptshift(15..last)...] };
|
||||
end permute
|
||||
|
||||
@: {ct:[ $left... ], pt: [ $right... ], result:[]};
|
||||
$... -> #
|
||||
'$@.result...;' !
|
||||
|
||||
when <?($decode <=0>)> do
|
||||
def plain: $;
|
||||
def index: $@.pt -> \[i](<=$plain> $i!\) -> $(1);
|
||||
..|@.result: $@.ct($index);
|
||||
$index -> permute -> !VOID
|
||||
otherwise
|
||||
def cipher: $;
|
||||
def index: $@.ct -> \[i](<=$cipher> $i!\) -> $(1);
|
||||
..|@.result: $@.pt($index);
|
||||
$index -> permute -> !VOID
|
||||
end chaocipher
|
||||
|
||||
'WELLDONEISBETTERTHANWELLSAID' -> chaocipher&{left:'HXUCZVAMDSLKPEFJRIGTWOBNYQ', right:'PTLNBQDEOYSFAVZKGJRIHWXUMC',decode:0} -> '$;
|
||||
' -> !OUT::write
|
||||
|
||||
'OAHQHCNYNXTSZJRRHJBYHQKSOUJY' -> chaocipher&{left:'HXUCZVAMDSLKPEFJRIGTWOBNYQ', right:'PTLNBQDEOYSFAVZKGJRIHWXUMC',decode:1} -> '$;
|
||||
' -> !OUT::write
|
||||
Loading…
Add table
Add a link
Reference in a new issue