http://www.perlmonks.org?node_id=1123235

My first JAPH for years and years. I'm not sure if this is platform-independent. I hope it is.
@z=split(//,BGu6pCozwKzR);@y=qw(zlz hqa zuo reg rqz fpx 72 26 25 53 25 + 06);while(@z){@a=split(shift@z,crypt(shift@y,pop@y));@g=split(pop@z, +$a[1]);print $g[0]}

Replies are listed 'Best First'.
Re: JAPH does the splits
by afoken (Chancellor) on Apr 13, 2015 at 10:48 UTC
    I'm not sure if this is platform-independent. I hope it is.

    perlfunc documents that crypt() is just a wrapper around the crypt() function in the C library. That function may be different on different platforms, according to POSIX: "The algorithm is implementation-defined." and "The first two bytes of this string [the salt argument] may be used to perturb the encoding algorithm." (i.e. implementations may choose to ignore the salt). The crypt function may even be not implemented: "The crypt() function shall fail if: ENOSYS The functionality is not supported on this implementation.". According to perlport, Android does not implement crypt(), and on Win32, it depends on how perl was compiled.

    So, unfortunately, this JAPH may not work on all platforms.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      According to perlport, Android does not implement crypt(), and on Win32, it depends on how perl was compiled

      AFAIK, you'd be hard pressed to find a Win32 perl less than 15 years old that doesn't have crypt().
      It's likely still possible to build perl on Windows such that crypt() is not available - but one would have to make a special effort to achieve that.

      Cheers,
      Rob