Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Substitution-cipher/Jq/substitution-cipher.jq
Normal file
25
Task/Substitution-cipher/Jq/substitution-cipher.jq
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
def key:
|
||||
"]kYV}(!7P$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs\"v*N[#wSl9zq2^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\\C1yxJ";
|
||||
|
||||
def encode:
|
||||
(key|explode) as $key
|
||||
| explode as $exploded
|
||||
| reduce range(0;length) as $i ([];
|
||||
. + [$key[ $exploded[$i] - 32]] )
|
||||
| implode;
|
||||
|
||||
def decode:
|
||||
(key|explode) as $key
|
||||
| explode as $exploded
|
||||
| reduce range(0;length) as $i ([];
|
||||
$exploded[$i] as $c
|
||||
| . + [ $key | index($c) + 32] )
|
||||
| implode ;
|
||||
|
||||
def task:
|
||||
"The quick brown fox jumps over the lazy dog, who barks VERY loudly!"
|
||||
| encode as $encoded
|
||||
|"Encoded: \($encoded)",
|
||||
"Decoded: \($encoded|decode)" ;
|
||||
|
||||
task
|
||||
Loading…
Add table
Add a link
Reference in a new issue