I need to stop others from editing or viewing my code for a PHP based project.
I wanted to to "encrypt" (is that the right word?) my PHP code so others can't read it.
Can PHP even do this? My preference if for an open-source/free solution.
I need to stop others from editing or viewing my code for a PHP based project.
I wanted to to "encrypt" (is that the right word?) my PHP code so others can't read it.
Can PHP even do this? My preference if for an open-source/free solution.
I guess encode and obfuscate is what you're looking for, e.g. something like:
Let's start with the actual PHP function:
function XOREncryption($InputString, $KeyPhrase){
$KeyPhraseLength = strlen($KeyPhrase);
// Loop trough input string
for ($i = 0; $i //SALT
$salt = 'my_special_phrase';
//ENCRYPT
$crypted = base64_encode(XOREncryption('my string', $salt));
echo "Encrypted: " . $crypted . "
";
The variable ' $salt ' plays a crucial role here. It is essentially the 'key' to your encrypted string. The salt value will always generate the same values when the same mathematics are applied to it. It provides the constant needed to generate randomness. This goes to say that if someone uses the salt that was used to generate the encryption and applies the same mathematics they can undo or reverse the encrypted string back into the original string text.