You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

rot13

NOTE: ROT13 isn't designed to be secure. It's designed to hide text that can be cracked very easily. It is popular as a spoiler hider on some old-school forums and newsgroups.

rot13(str)
Returns the given text encrypted/decrypted with the rot13 algorithm.
COPY/// rot13(str)
//
//  Returns the given text encrypted/decrypted with the rot13 algorithm.
//
//      str         text to be encrypted/decrypted, string
//
/// GMLscripts.com/license
{
    var a, b, str, len, val, i;
    a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    b = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
    str = string_letters(argument0);
    len = string_length(str);
    val = "";
    for (i=1; i<=len; i+=1)
    val += string_char_at(b,string_pos(string_char_at(str,i),a));
    return val;
}

Contributors: Austin

GitHub: View · Commits · Blame · Raw