PDA

View Full Version : Crypto rot13 and numbers



ianhull
10-25-2005, 07:26 AM
Can anyone help me in encryting number using the rot13?

I have had it for ages and never tested it with numbers, now I desperatley need to encrypt numbers with it.

please help.

Thanks in advance.

TJ_Tigger
10-25-2005, 10:14 AM
ROT13 focuses on alphabetic characters only, rotate alphabet 13 characters. After you run your string through the rot13 encryption you can create your own function to take care of the numbers.

There might be a better way but you can try this, it should only convert numbers.



function RotN5(strEncryptMe)
local stroutput = "";
for x = 1, String.Length(strEncryptMe) do
local num = String.Asc(String.Mid(strEncryptMe)
if num > 48 and num < 52 then
num = num+5;
elseif num > 53 and < 57 then
num = num-5;
end
stroutput = stroutput .. String.Char(num);
end
return stroutput;
end