From the man page of memfrob
:
void *memfrob(void *s, size_t n);
The memfrob() function encrypts the first n bytes of the memory area s by exclusive-ORing each character with the number 42. The effect can be reversed by using memfrob() on the encrypted memory area.
Note that this function is not a proper encryption routine as the XOR constant is fixed, and is only suitable for hiding strings.
I have the following questions regarding the memfrob
function:
- Why is the XORing done with number 42?
- Is there any reason why XOR constant is fixed and why the designers of
memfrob
did not leave choice of the constant to the user? - In what sense is it suitable for hiding strings? Since it can be reversed and therefore shouldn't be used in applications where encryption is important, what it is used for on practice?