澳门皇冠金沙网站-澳门皇冠844网站

热门关键词: 澳门皇冠金沙网站,澳门皇冠844网站

澳门皇冠844网站使用jscript实现二进制读写脚本代

    /* Convert a octet number to a code page 437 char code */
    this.Forward437 = function(inString)
    {
        var encArray = new Array();
        var tmp='';
        var i=0;
        var c=0;
        var l=inString.length;
        var cc;
        var h;
        for(;i<l; i)
        {
            c ;
            if(c==128)
            {
澳门皇冠844网站,                encArray.push(tmp);
                tmp='';
                c=0;
            }
            cc=inString.charCodeAt(i);
            if(cc<128)
            {
                tmp =String.fromCharCode(cc);
            }      
            else
            {
                h=this.d2h(cc);
                h=forward['' h];
                tmp =String.fromCharCode(this.h2d(h));
            }
        }
        if(tmp!='')
        {
            encArray.push(tmp);
        }

可是小编又不能够直接存"6E".getBytes();
搞一天了。
大大些协理啊

    var hD="0123456789ABCDEF";
    this.d2h = function(d)
    {
        var h = hD.substr(d&15,1);
        while(d>15) {d>>=4;h=hD.substr(d&15,1) h;}
        return h;
    }

未来网址换来jsp的了,用hibernate,那时客商输入8,作者该怎么存,能力让顾客端软件收取来是6E呢?
"8".getBytes();料定是足够的,那几个存进去是56,出来鲜明就难堪了;

...

java转码的主题材料
各位大大些,帮忙啊
遇到的标题是如此的
先说数据库是sqlserver的,密码字段是 varbinary,
今后是因而网址登记,然后用注册的账号在客商端软件上登陆
先前网址是PHP的,是这般转密码的:
$EncTable = array('!'=>'95', '"'=>'88', '#'=>'9D', '$'=>'4C', '%'=>'F2',
'&'=>'3E', '''=>'BB', '('=>'C0', ')'=>'7F', '*'=>'18', ' '=>'70',
','=>'A6', '-'=>'E2', '.'=>'EC', '/'=>'77',
'0'=>'2C', '1'=>'3A', '2'=>'4A', '3'=>'91',
'4'=>'5D', '5'=>'7A', '6'=>'29', '7'=>'BC', '8'=>'6E', '9'=>'D4', ':'=>'40',
';'=>'17', '<'=>'2E', '='=>'CB', '>'=>'72', '?'=>'9C',
'@'=>'A1', 'A'=>'FF', 'B'=>'F3', 'C'=>'F8',
'D'=>'9B', 'E'=>'50', 'F'=>'51', 'G'=>'6D', 'H'=>'E9', 'I'=>'9A', 'J'=>'B8',
'K'=>'84', 'L'=>'A8', 'M'=>'14', 'N'=>'38', 'O'=>'CE',
'P'=>'92', 'Q'=>'5C', 'R'=>'F5', 'S'=>'EE',
'T'=>'B3', 'U'=>'89', 'V'=>'7B', 'W'=>'A2', 'X'=>'AD', 'Y'=>'71', 'Z'=>'E3',
'['=>'D5', ''=>'BF', ']'=>'53', '^'=>'28', '_'=>'44',
'`'=>'33', 'a'=>'48', 'b'=>'DB', 'c'=>'FC',
'd'=>'09', 'e'=>'1F', 'f'=>'94', 'g'=>'12', 'h'=>'73', 'i'=>'37', 'j'=>'82',
'k'=>'81', 'l'=>'39', 'm'=>'C2', 'n'=>'8D', 'o'=>'7D',
'p'=>'08', 'q'=>'4F', 'r'=>'B0', 's'=>'FE',
't'=>'79', 'u'=>'0B', 'v'=>'D6', 'w'=>'23', 'x'=>'7C', 'y'=>'4B', 'z'=>'8E',
'{'=>'06', '|'=>'5A', '}'=>'CC', '~'=>'62');
她把转之后的就足以把那几个存进数据库了,举个例子输入8,存入数据库的是 6E 的byte值
从数据Curry收取来也是6E,那年客商端抽取来是6E
身为客商端也是把数据库的值按16进制读取的,但是8的16进制的值又不是6E。

    this.WriteAll = function(what)
    {
        //Create Stream object
        var BinaryStream = WScript.CreateObject("ADODB.Stream");
        //Specify stream type - we cheat and get string but 'like' binary
        BinaryStream.Type = adTypeText;
        BinaryStream.CharSet = '437';         
        //Open the stream
        BinaryStream.Open();
        // Write to the stream
        BinaryStream.WriteText(this.Forward437(what));
        // Write the string to the disk
        BinaryStream.SaveToFile(this.path, adSaveCreateOverWrite);

        // Clearn up
        BinaryStream.Close();
    }

        // this loop progressive concatonates the
        // array elements entil there is only one
        var ar2=new Array();
        for(;encArray.length>1;)
        {
            var l=encArray.length;
            for(var c=0;c<l;c =2)
            {
                if(c 1==l)
                {
                    ar2.push(encArray[c]);
                }
                else
                {
                    ar2.push('' encArray[c] encArray[c 1]);
                }
            }
            encArray=ar2;
            ar2=new Array();
        }
        return encArray[0];
    }
    /* Convert a code page 437 char code to a octet number*/
    this.Backward437 = function(inString)
    {
        var encArray = new Array();
        var tmp='';
        var i=0;
        var c=0;
        var l=inString.length;
        var cc;
        var h;
        for(;i<l; i)
        {
            c ;
            if(c==128)
            {
                encArray.push(tmp);
                tmp='';
                c=0;
            }
            cc=inString.charCodeAt(i);
            if(cc<128)
            {
                tmp =String.fromCharCode(cc);
            }
            else
            {
                h=this.d2h(cc);
                h=backward['' h];
                tmp =String.fromCharCode(this.h2d(h));
            }
        }
        if(tmp!='')
        {
            encArray.push(tmp);
        }

    this.path=name;

    var forward  = new Array();
    var backward = new Array();

本文由澳门皇冠金沙网站发布于前端开发,转载请注明出处:澳门皇冠844网站使用jscript实现二进制读写脚本代