View Full Version : Help-Variable Based Encoder
rocko234
06-20-2005, 05:24 AM
I'm brand new in the programming comunity and don't know much about programming, so this may sound dumb. I'm wondering if there is such thing as a 'program creating program' based on variables. I'm wondering because I'm thinking about making a encoder that could encode messages and numbers into -put anything digital here-.
suryad
06-20-2005, 06:46 AM
Hmm I am still not following what you are trying to achieve...a more solid example would be great.
rocko234
06-20-2005, 11:17 PM
Lets say your wanting to keep a secret between yourself and a friend,
you and him would have a encoders installed on your comps. It would translate letters and number to other numbers.
EX:
A=1___0=0
B=2___1=6
C=4___2=12
D=8___3=18 <---This stuff would be put into a app. so when you type HE into
E=16___4=24 ____one box 128,16 would come out in the other. Vice-versa.
F=32___5=30
G=64___Ect.
H=128
I=256
Ect.
You could decrypt one and one number like this (java):
String chars = "abcdefghijklmnopqrstuvwxyz123456789";
....
.....
char dec(int nr)
{
if(nr%6 != 0)
{
double i = Math.log(nr) / Math.log(2);
return chars.charAt((int)i);
}
else
return chars.charAt(nr/6 +25);
}
and enctypt
char[] tArray = textToEncrypt.toCharArray();
for(int i=0; i<tArray.length; i++)
{
int j = chars.indexOf(tArray[i]);
if(j<26)
result += (int) Math.pow(2,j) + ",";
else
result += (Integer.parseInt(""+tArray[i]) * 6) +",";
}
suryad
06-21-2005, 08:01 PM
Haha nice JPM! Very nice.
rocko234
06-22-2005, 03:30 AM
Oh, I just found out its not called encoding, its called cryptology.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.