Crypto rot13 and numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • ianhull
    Forum Member
    • Jul 2004
    • 314

    Crypto rot13 and numbers

    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
    Indigo Rose Customer
    • Sep 2002
    • 3159

    #2
    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.

    Code:
    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
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

    Comment

    Working...
    X