document.formname.password.value = hexMD5('\027' + document.formname.password.value + '\340\174\012\314\214\070\070\231\377\005\016\132\270\024\241\163'); #### #!/usr/bin/perl use strict; use Digest::MD5; #Example 1==================== my $chapid = "\027"; my $chapchalange = "\340\174\012\314\214\070\070\231\377\005\016\132\270\024\241\163"; print "\nExample1=". Digest::MD5::md5_hex($chapid."AAA".$chapchalange); #Example2===================== my $chapid2= '\027'; my $chapchalange2= '\340\174\012\314\214\070\070\231\377\005\016\132\270\024\241\163'; print "\nExample2=".Digest::MD5::md5_hex($chapid2."AAA".$chapchalange2); #### Example1=18ed4d4f656255182e771016deb7d23a Example2=3f40ad10610755cefd8223a3a1a566db #### Example1= ------------------------ SV = PV(0x80120d070) at 0x801269f18 REFCNT = 1 FLAGS = (PADTMP,POK,pPOK) PV = 0x801209f58 "\27AAA\340|\n\314\21488\231\377\5\16Z\270\24\241s"\0 CUR = 20 LEN = 24 ------------------------------ Example2= ------------------------------- SV = PV(0x80120d650) at 0x8012c5810 REFCNT = 1 FLAGS = (PADTMP,POK,pPOK) PV = 0x80124ec58 "\\027AAA\\340\\174\\012\\314\\214\\070\\070\\231\\377\\005\\016\\132\\270\\024\\241\\163"\0 CUR = 71 LEN = 72 #### { 'username' => 'Ptestuser', 'password' => '18ed4d4f656255182e771016deb7d23a', 'chap-id' => '\\027', 'chap-challenge' => '\\340\\174\\012\\314\\214\\070\\070\\231\\377\\005\\016\\132\\270\\024\\241\\163', }; #### ------------------- Encode::decode('UTF-8'...); ------------------- utf8::decode(); ------------------- binmode STDIN, ":encoding(utf8)"; ------------------- use CGI qw( -utf8 ); ------------ use Encode qw(decode); use URI::Escape::XS qw(decodeURIComponent); $_ = decode('UTF-8', decodeURIComponent($_), Encode::FB_CROAK); ------------- s{%([a-fA-F0-9]{2})}{ pack ("C", hex ($1)) }eg; # Kept from existing code s{%u([0-9A-F]{4})}{ pack ('U*', hex ($1)) }eg; # Added utf8::decode $_; --------------- and many others