[Include] [INC] Simple Encrypt
#1

Hey guys, I saw some simple Crypting stuff so I build a simple Crypting function what is based on the Vigenиre Crypting.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
Z A B C D E F G H I J K L M N O P Q R S T U V W X Y

You just get the position of the letter of the key and the string, multiply it.Thats all.

WARNING: This method is only useable for a key that is not longer then 26 letters.

Code:
public Encrypt(string[],key[])
{
	new str[26],b,c,d[27] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",e;
	for(new i; i<strlen(string); i++)
	{
		for(new k;k<strlen(d);k++)
		{
		  if(string[i]==d[k])
		  {
		    b=k;
		  }
		  if(key[i]==d[k])
		  {
		    c=k;
		  }
		}
		e=(b*c);
		e=e%strlen(d);
		format(str,sizeof(str),"%s",d[e]);
	}
	return 1;
}
I think thats all the facts about it, have fun,
Reply
#2

good job
Reply
#3

If you look past the picture you'll see a sail boat.


Also, you'd be hard pressed to find a reason for this.
Good job none-the-less.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)