admin管理员组文章数量:1566222
2024年7月25日发(作者:)
}
switch ( pads ) {
case 1:
b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 );
(b10 >> 16);
((b10 >> 8) & 0xff);
break;
case 2:
b10 = ( _getbyte64( s, i ) << 18) | ( _getbyte64( s, i + 1 ) << 12 );
(b10 >> 16);
break;
}
_decode_chars(y, x);
if( > 0) throw "Cannot decode base64";
return ( "" );
}
function _get_chars(ch, y){
if(ch < 0x80) (ch);
else if(ch < 0x800){
(0xc0 + ((ch >> 6) & 0x1f));
(0x80 + (ch & 0x3f));
}else{
(0xe0 + ((ch >> 12) & 0xf));
(0x80 + ((ch >> 6) & 0x3f));
(0x80 + (ch & 0x3f));
}
}
function _encode( s ) {
if ( !== 1 ) {
throw "SyntaxError: exactly one argument required";
}
s = String( s );
if ( === 0 ) {
return s;
}
//s = _encode_utf8(s);
var i,
b10,
y = [],
x = [],
len = ;
i = 0;
while(i < len){
_get_chars(deAt(i), y);
while( >= 3){
var ch1 = ();
var ch2 = ();
var ch3 = ();
b10 = ( ch1 << 16 ) | ( ch2 << 8 ) | ch3;
( _( b10 >> 18 ) );
( _( ( b10 >> 12 ) & 0x3F ) );
( _( ( b10 >> 6 ) & 0x3f ) );
( _( b10 & 0x3f ) );
}
i++;
}
switch ( ) {
case 1:
var ch = ();
b10 = ch << 16;
( _( b10 >> 18 ) + _( ( b10 >> 12 ) & 0x3F ) + _PADCHAR + _PADCHAR );
break;
case 2:
var ch1 = ();
var ch2 = ();
b10 = ( ch1 << 16 ) | ( ch2 << 8 );
( _( b10 >> 18 ) + _( ( b10 >> 12 ) & 0x3F ) + _( ( b10 >> 6 ) & 0x3f ) + _PADCHAR );
break;
}
return ( "" );
}
版权声明:本文标题:uniapp-base64加密解密(不会中文乱码) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1721906342a904287.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论