Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10457
    Stefan
    Participant

    The other day i wanted to know what is written in the registry under ‘UserAssist’.
    I know i can decrypt them by using an additional entry ‘NoEncrypt’
    but it was not my pc and i just wanted to know something quickly.

    So i remembered i did this coding already twice in other languages and now i wanted to see
    if i am skilled enough to do this in JavaScript again… and it worked.

    Examples:
    FROM:
    {0139Q44R-6NSR-49S2-8690-3QNSPNR6SSO8}Zvpebfbsg BssvprZvpebfbsg Rkpry 2010.yax=””
    TO:
    {0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}Microsoft OfficeMicrosoft Excel 2010.lnk=””

    FROM:
    clipboardData.setData( sDataFormat, sData, iPos );
    EmEditor ROT13 macro
    TO:
    pyvcobneqQngn.frgQngn( fQngnSbezng, fQngn, vCbf );
    RzRqvgbe EBG13 znpeb

    ROT13 is an very simple letter substitution cipher know too as caesar cipher.
    http://en.wikipedia.org/wiki/ROT13

    Here is my code:



    // INPUT =================================
    //Sel = clipboardData.getData("Text");
    Sel = document.selection.Text;
    if(Sel.length == 0) quit();
    //Sel = Sel.replace(/(^s*)|(s*$)/g, ""); //LTrim/RTrim
    //if(Sel.length > 20000) Sel = Sel.substr(0, 20000); //not to many please ;-)
    out ="";

    // CODE =================================
    for(Pos=0,strLen=Sel.length;Pos<strLen;Pos++){
    nASC = Sel.charCodeAt(Pos);

    if(nASC > 64 && nASC < 91){
    nASC = nASC +13;
    if(nASC > 90){nASC -= 26;}
    out += String.fromCharCode(nASC);
    }else if(nASC > 96 && nASC < 123){
    nASC = nASC +13;
    if(nASC > 122){nASC -= 26;}
    out += String.fromCharCode(nASC);
    }else{
    out += Sel.charAt(Pos);
    }

    }
    // OUTPUT =================================
    // //Out to an dialog:
    // if(Sel.length > 1000) Sel = Sel.substr(0, 1000); //shorten for the dialog box
    // if(out.length > 1000) out = out.substr(0, 1000); // remove for to insert into an document
    // alert(Sel + 'nn' + Sel.length + ' signs ROT13 =>nn' + out);

    // //Replace clipboard with processed text:
    // clipboardData.setData("Text", out);

    //Replace selected text with processed text:
    document.selection.Text = out;

    (why are this code blocks always that small in this forum? Or is this an firefox issue?)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.