-------owned-------
Guru
Yes, guys, I know it's newbie-stuff, I do NOT need any feedback. Thank you.
I just can't figure a way to reverse it.
Can anyone help? ^_^
I just can't figure a way to reverse it.
Can anyone help? ^_^
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
/* Integers */
int charPos;
int plainlen;
int x = 0;
int a = 0;
int b = 0;
int random;
int i;
int y = 0;
int random1 = 0;
int z = 0;
int declen;
/* Character arrays (strings) */
char plaintext[100];
char encryptedtext[100];
/* Methods */
void encipher(char plain[]);
void decipher(char enc[]);
int string_length(char str[]);
/* End */
char block[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!#¤%&/()=?";
char input[100];
int main(char* argv[]) {
scanf ("%s",&plaintext) ;
i = string_length(plaintext);
encipher(plaintext);
decipher(plaintext);
}
int string_length(char* plaintext) {
return strlen(plaintext);
}
void encipher(char plain[]) {
srand ( time(NULL) );
while(x < i) {
while(y < 8) {
while(z < 7) {
random1 = rand() % 67 + 1;
printf("%c",block[random1]);
z++;}
z = 0; printf("%c",plaintext[x]);
y++;
x++;
}
}
}
void decipher(char enc[]) {
declen = string_length(enc);
plainlen = declen / 8;
while(a < plainlen) {
b = b + 8;
printf("%c",enc[b]);
}
return;
}




