Gamemaker Substitution Cipher

create event:
alpha_src = " 0123456789abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";//Plain Text
alpha_dst = "tuwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789abcdefghijklmnopqrs";//Encoded Text
text1 = get_string("Source:", "");//Get string to convert

index = 1;//position in Plain text
str = ""; // result
for (var index = 1; index < string_length(text1)+1; index += 1)
{
char = string_char_at(text1, index);//get character at position in string
pos = string_pos(char, alpha_src);//find position of letter in Plain Text
if (pos > 0)
{
// if char occurs in source alphabet, add
// according one from destination alphabet
// to output
str += string_char_at(alpha_dst, pos);//At letter from position in Encoded
}
else
{
// otherwise just add itself
str += char;
}
}
result=str;//result is finished encoded
show_message(result);//show encoded message

No comments:

The Win Machine

The Road to Hell is Paved with Intervention ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏    ...

Contact Form

Name

Email *

Message *