Xor Value of String

artur_urban

Member
I need to create a BSFN with string as a passed in parameter that would return a "Xor" value of the string.
Is there any C++ function doing that?
 
I don't think there is one. I imagine you're trying to encrypt something?

Try this code in your own function:

char * EncDecString( char * InputString, char * Key ){
char *strptr = InputString;
char *keyptr = Key;

for( int i=0; i < strlen( InputString ); i++ ){
xor( strptr, kryptr );
strptr++; keyptr++;
}

return InputString;
}
 
Thanks for help. I actually don't want to encrypt string. "Xor" of a string is counted this way: 's' xor 't' xor 'r' xor 'i' xor 'n' xor 'g'. The result will be used as a CheckSum at the end of a record passed to the fiscal printer. If the CheckSum is not correct no slip will be printed. But thanks for your code. It's very useful.
 
Back
Top