User:SignpostMarv Martin/PHP/llXorBase64StringsCorrect
< User:SignpostMarv Martin
Jump to navigation
Jump to search
Revision as of 06:26, 15 January 2007 by SignpostMarv Martin (talk | contribs) (released PHP implementation of llXorBase64StringsCorrect)
The following code is an implementation of {{{2}}} in PHP.
Feel free to use it, as it's published under the same Creative Commons license as this entire Wiki (BY-SA).
<?php
function llXorBase64StringsCorrect($s1,$s2)
{
# Description: Implementation of the LSL2 function llXorBase64StringsCorrect()
# Author: SignpostMarv Martin
# Taken from Code library last updated: 2007-01-05
# Released under http://creativecommons.org/licenses/by-sa/2.5/
# Method of Attribution:
#* zero-modification of these credits in the source code
#* link to this page in appropriate credits documentation e.g.;
#** website "powered by" blurb
#** digital or physical documentation medium credits page
#** link to this page in a README file where appropriate.
if(strlen(base64_decode($s1)) > strlen(base64_decode($s2)))
{
$s2 = base64_encode(str_pad(base64_decode($s2),strlen(base64_decode($s1)),base64_decode($s2),STR_PAD_RIGHT));
}
return base64_encode(base64_decode($s1) ^ base64_decode($s2));
}
?>