RC4 encrypt in PeopleSoft

Source: Internet
Author: User

Cause: we often encounter URL encryption. At present, no matter the information about PeopleSoft in China or abroad is far less than that of C # VB and other materials.

After: in desperation, I had to understand the encryption principle of RC4 and write a method myself.

Result: After several days of hard work. The Code is as follows. Harassment is welcome if you have any questions.

 

Function iscript_revengeboy

& Link = msggetexplaintext (32000, 62, "message not found ");
& Squery = "http://home.cnblogs.com/RevengeBoy ";
& Key = "UW * $2i5 ";
Local array of any & S, & b16_map;
& B16_digits = "0123456789 abcdef ";
& B16_map = createarray ();
& Result = createarray ();
& S = createarray ();

& Times = 0;
For & I3 = 0 to 255;
If Mod (& I3, 16) = 0 and
& I3 <> 0 and
& I3 <> 255 then
& Times = & times + 1;
End-if;
& Charath1 = substring (& b16_digits, & times + 1, 1 );
& Charath2 = substring (& b16_digits, MOD (& I3, 16) + 1, 1 );
& B16_map [& I3 + 1] = & charath1 | & charath2;
REM % response. write ("I =" | & I3 | "Times =" | & times | ", MOD (& I3, 15) =" | Mod (& I3, 16) | "<br> ");

REM % response. Write ("& b16_map [" | (& I3 + 1) | "] =" | & charath1 | & charath2 | "<br> ");
& Map = & charath1 | & charath2;
REM % response. Write (& map );
End-;


For & I0 = 1 to 256;
& S [& I0] = & I0-1;
End-;

& J = 0;
& Amp; X = 0;
For & I = 0 to 255;
& Charatx = substring (& Key, MOD (& I, Len (& Key) + 1, 1 );
& J = Mod (& J + & S [& I + 1] + code (& charatx), 256 );
& X = & S [& I + 1];
& S [& I + 1] = & S [& J + 1];
& S [& J + 1] = & X;
End-;

& I2 = 0;
& J = 0;
& Ct = "";
& STR = "";
For & Y = 0 to Len (& squery)-1;
& I2 = Mod (& I2 + 1), 256 );
& J = Mod (& J + & S [& I2 + 1]), 256 );
& X = & S [& I2 + 1];
& S [& I2 + 1] = & S [& J + 1];
& S [& J + 1] = & X;
& Charaty = substring (& squery, & Y + 1, 1 );
& Char1 = Code (& charaty );
& Char2 = & S [Mod (& S [& I2 + 1] + & S [& J + 1]), 256) + 1];
Sqlexec ("select (" | & char1 | "+" | & char2 | ")-bitand (" | & char1 | "," | & char2 | ") * 2 from dual ", & Str );
& Ct = & CT | & b16_map [& STR + 1];

End-;
Rem reuslt
% Response. Write (& link | "W" | & CT );

End-function;

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.