If you really want to do this why don’t you port some code from GitHub you linked to to Perl?

function rot8000() { // these come from the valid-code-point-transitions.json file gene +rated from the c# proj // this is done bc: 1) don't trust JS's understanging of surrogate + pairs and 2) consistency with original rot8000 const valid_code_points = JSON.parse('{"33":true,"127":false,"161":true,"5760":false,"57 +61":true,"8192":false,"8203":true,"8232":false,"8234":true,"8239":fal +se,"8240":true,"8287":false,"8288":true,"12288":false,"12289":true,"5 +5296":false,"57344":true}'); const BMP_SIZE = 0x10000; this.rotlist = {}; // the mapping of char to rotated char hiddenblocks = []; var startblock = 0; for (var key in valid_code_points) { if (valid_code_points.hasOwnProperty(key)) { if (valid_code_points[key] == true) hiddenblocks.push({ start: startblock, end: parseInt(k +ey) - 1 }); else startblock = parseInt(key); } } var validintlist = []; // list of all valid chars var currvalid = false; for (var i = 0; i < BMP_SIZE; i++) { if (valid_code_points[i] !== undefined) { currvalid = valid_code_points[i] } if (currvalid) validintlist.push(i); } var rotatenum = Object.keys(validintlist).length / 2; // go through every valid char and find its match for (var i = 0; i < validintlist.length; i++) { this.rotlist[String.fromCharCode(validintlist[i])] = String.fromCharCode(validintlist[(i + rotatenum) % (rotate +num * 2)]); } this.rotate = function(convstring) { var outstring = ""; for (var count = 0; count < convstring.length; count++) { // if it is not in the mappings list, just add it directly + (no rotation) if (this.rotlist[convstring[count]] === undefined) { outstring += convstring[count]; continue; } // otherwise, rotate it and add it to the string outstring += this.rotlist[convstring[count]]; } return outstring; } } module.exports = {rot8000};

Remember

«The Crux of the Biscuit is the Apostrophe»


In reply to Re: ROT8000 implementation? by karlgoethebier
in thread ROT8000 implementation? by jwkrahn

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.