31 lines
632 B
Text
31 lines
632 B
Text
include xpllib; \for StrLen, Print
|
|
char Key;
|
|
|
|
func Index(S, C);
|
|
char S, C, I;
|
|
[for I:= 0 to StrLen(S)-1 do
|
|
if S(I) = C then return I;
|
|
return -1;
|
|
];
|
|
|
|
func Encode(S);
|
|
char S, I;
|
|
[for I:= 0 to StrLen(S)-1 do
|
|
S(I):= Key(S(I)-32);
|
|
return S;
|
|
];
|
|
|
|
func Decode(S);
|
|
char S, I;
|
|
[for I:= 0 to StrLen(S)-1 do
|
|
S(I):= Index(Key, S(I)) + 32;
|
|
return S;
|
|
];
|
|
|
|
char S, Enc;
|
|
[Key:= "]kYV}(!7P$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs^"v*N[#wSl9zq2^^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\C1yxJ";
|
|
S:= "The quick brown fox jumps over the lazy dog, who barks VERY loudly!";
|
|
Enc:= Encode(S);
|
|
Print("Encoded: %s\n", Enc);
|
|
Print("Decoded: %s\n", Decode(Enc));
|
|
]
|