Skip to content
Snippets Groups Projects
Commit a2a08210 authored by Martin Nilsson's avatar Martin Nilsson
Browse files

Removed rot13. Added as Crypto.rot13

Rev: lib/modules/String.pmod/module.pmod:1.28
parent 22171d56
Branches
Tags
No related merge requests found
......@@ -286,30 +286,3 @@ static string line_expand_tab(string line, int tab_width,
}
return result;
}
//! rotates each character by 13 positions
string rot13(string input)
{
return rot(input, 13);
}
//! rotates each character by n positions
string rot(string input, int pos)
{
for(int i=0; i<sizeof(input); i++)
{
if (input[i] >= 65 && input[i] <= 90)
{
input[i] += pos;
if (input[i] > 90)
input[i] -= 26;
}
else if (input[i] >= 97 && input[i] <= 122)
{
input[i] += pos;
if (input[i] > 122)
input[i] -= 26;
}
}
return input;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment