-
Simple Filter
I was wondering if there was a way to make a simple filter (other than ROT13) for passwords so that I can put it through the filter and then save it into a text file so that it is there but not directly. I would need to make one function to filter and then another to un-filter. I just don't know where to start.
~Sven
-
Table based comes to mind
That would be where you have a static table known only to the encoder and decoder which modifies the stream. Another idea is XOR (there's a faq)
-
So I just make a section with a bunch of statements like...
Code:
if(toupper(c)=='A'){
c='R';
}
and then in the decoder have it be...
Code:
if(toupper(c)=='R'){
c='a'
}
?????
-
Here's an example
Code:
#include <stdio.h>
int main()
{
char table [] = "randomletters";
char input [] = "testinputchar";
char output [13];
unsigned int i;
for (i = 0; i < sizeof(input); i++)
output[i] = input[i] + table[i];
printf (output);
}
My code is simplified in 2 aspects. One, you would not statically allocate your output like I did, and the input and table will not be the same length. The solution is pretty easy to implement, just have an iterator that bounces back to the begining of the table once you reach the end.