You are not logged in.
Pages: 1
hey im a total newb @ C++ but im making a simple encryption program for a small project of mine.
anyway what i want is, take the text from a variable and encrypt it and then send the encrypted text to a new variable.
i have 2 char arrays holding the letters and respective "encrypted" letter.
looks like this:
char *alfa = "abcdefghijklmnopqrstyvwxyz";
char *beta = "mqfjhldxgnwersuabkizpyvtco";
(ive also thought about having 2 strings holding the letters if thats easier, like this:
string alfa ("abcdefghijklmnopqrstuvwxyz");
string beta("mqfjhldxgnwersuabkizpyvtco");)
anyway, i have no idea of how to convert the letters in a variable to the respective letters as seen in the *beta variable.
im very happy for any help i can get, and please i know this is neewbish, but im in the beginning of learning C++ (and programming at all )
and im sorry for my english.
A w e s o m e
r
c
h
Offline
Is this school based? Or personal? Is there any reason you cannot just use an existing one-way hash implementation, like md5 or sha1?
Offline
http://www.cplusplus.com/reference/string/
That should have enough information for you to figure out what you need.
Offline
thanks cerebral, ill read through it.
and phrakture: its personal
A w e s o m e
r
c
h
Offline
beta is basically array with letter to put instead of 'a' in place 0, instead of 'b' in place 1 and so on.
so, beta[ch - 'a'] will give you "encrypted" letter which should be used instead of char ch.
Offline
You want a char array, so why use string or char*? Go for char[]
Offline
Pages: 1