I am triying to make a program which encodes a user password and writes it to a file this is what I have:
Code:
/*ENCODER*/
void Encoder(char *Code)
{
for (int i = 0; i < strlen(Code); i++)
Code[i] -= 30;
Code[i] = '\0';
}
Code:
/*DECODER*/
void Decoder(char *Code)
{
for (int i = 0; i < strlen(Code); i++)
Code[i] += 30;
Code[i] = '\0';
}
it works fine, but I want to do something better like
Code:
/*ENCODER*/
void Encoder(char *Code)
{
for (int i = 0; i < strlen(Code); i++)
Code[i] = (Code[i] * 100) % 256;
Code[i] = '\0';
}
The only problem with that is that I would have no idea how to decode it, could someone describe how the modulus works so I can find a way to decode the arry please?