It's not clear to me that there is a commonly-known PHP function called "XORmask" (at least, nothing that can be found via Google). Could you point us to some documentation that describes this function? (Could it be something that is defined in the PHP code that you started from?)

Also, unless there's a description of this "XORmask" function that explains how it arrives at the output you say it yields, I'm at a loss how to come up with similar results.

I tried this little test script, which decodes your base64 input string to the series of bytes you suggest - but just to be clear, I'm displaying each byte as a 2-digit hex number; I'm also breaking up the character sequence that you say you expect to get as a result, and I display this as a sequence of hex numbers as well. The two sequences are displayed next to each other below, values from decode_base64 on the left, and your expected output on the right:

perl -MMIME::Base64 -e '$_="Z0xcAVtKAwkDHVcKVF5TCQ"; @i=split //,decode_base64($_); @t=split //,"T|808|586|127800"; printf("%3d: %02x %02x\n",$_,ord($i[$_]),ord($t[$_])) for (0..$#i)' 0: 67 54 1: 4c 7c 2: 5c 38 3: 01 30 4: 5b 38 5: 4a 7c 6: 03 35 7: 09 38 8: 03 36 9: 1d 7c 10: 57 31 11: 0a 32 12: 54 37 13: 5e 38 14: 53 30 15: 09 30
So, apart from not seeing any coherent pattern here, I'm wondering what sort of function this is supposed to be. It's clearly not any kind of bit-wise logic operation, because a given input value can 'yield' different outputs (lines "7:" and "15:" above), and different inputs can yield the same output (lines "3:", "14." and "15.").

You need to give us a better description of the functionality you are looking for.


In reply to Re: Perl function equivalent to PHP xormask by graff
in thread Perl function equivalent to PHP xormask by wubbaducki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.