Kyle Undefined
2012-04-12 00:31:14
I was bored tonight, so I made this. I saw something like this awhile ago and thought it was neat. It just shifts the text 13 chars over to "encrypt" it, but it's not really encryption. Try it out! :)
Thanks to m34tcode for helping me work through a few ideas on Skype.
Thanks to m34tcode for helping me work through a few ideas on Skype.
program Shift13;
const
_text = 'THIS is a TesT';
function getCharArray(whatString : string) : TStringArray;
var
tempArray : TStringArray;
tempString : string;
count, i : Integer;
begin
tempString := whatString;
repeat
Delete(tempString, 1, 1);
Inc(count);
until(tempString = '');
Setlength(tempArray, count);
for i := 0 to (count - 1) do
tempArray[i] := Copy(whatString, i + 1, 1);
Result := tempArray;
end;
function toChar(s : string) : Char;
begin
Result := s[1];
end;
function _shift(s : string) : string;
var
tmpStrArr : TStringArray;
res : string;
i : Integer;
c : LongInt;
begin
tmpStrArr := getCharArray(s);
for i := 0 to High(tmpStrArr) do
begin
c := Ord(toChar(tmpStrArr[i]));
if(InRange(c, 97, 122))then
begin
IncEx(c, 13);
if(c > 122)then
DecEx(c, 26);
end else
if(InRange(c, 65, 90))then
begin
IncEx(c, 13);
if(c > 90)then
DecEx(c, 26);
end;
res := res + Chr(c);
end;
Result := res;
end;
function _reShift(s : string) : string;
begin
Result := _shift(s);
end;
procedure _main();
var
rText : string;
begin
rText := _shift(_text);
WriteLn('Original text := ' + _text);
WriteLn('Shifted text := ' + rText);
WriteLn('Re-shifted text := ' + _reShift(rText));
end;
begin
ClearDebug();
_main();
end.
It works! Thanks Kyle!