WeiWeiXinNet/Games/game3/js/other/base64.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

var toBase64 = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
	"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
	"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+" , "/", "="];
var fromBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function base64(data) {
	try {
		var base64 = window.btoa(data);	//Use this native function when it's available, as it's a magnitude faster than the non-native code below.
	}
	catch (error) {
		//Defaulting to non-native base64 encoding...
		var base64 = "";
		var dataLength = data.length;
		if (dataLength > 0) {
			var bytes = [0, 0, 0];
			var index = 0;
			var remainder = dataLength % 3;
			while (data.length % 3 > 0) {
				//Make sure we don't do fuzzy math in the next loop...
				data[data.length] = " ";
			}
			while (index < dataLength) {
				//Keep this loop small for speed.
				bytes = [data.charCodeAt(index++), data.charCodeAt(index++), data.charCodeAt(index++)];
				base64 += toBase64[bytes[0] >> 2] + toBase64[((bytes[0] & 0x3) << 4) | (bytes[1] >> 4)] + toBase64[((bytes[1] & 0xF) << 2) | (bytes[2] >> 6)] + toBase64[bytes[2] & 0x3F];
			}
			if (remainder > 0) {
				//Fill in the padding and recalulate the trailing six-bit group...
				base64[base64.length - 1] = "=";
				if (remainder == 2) {
					base64[base64.length - 2] = "=";
					base64[base64.length - 3] = toBase64[(bytes[0] & 0x3) << 4];
				}
				else {
					base64[base64.length - 2] = toBase64[(bytes[1] & 0xF) << 2];
				}
			}
		}
	}
	return base64;
}
function base64_decode(data) {
	try {
		var decode64 = window.atob(data);	//Use this native function when it's available, as it's a magnitude faster than the non-native code below.
	}
	catch (error) {
		//Defaulting to non-native base64 decoding...
		var decode64 = "";
		var dataLength = data.length;
		if (dataLength > 3 && dataLength % 4 == 0) {
			var sixbits = [0, 0, 0, 0];	//Declare this out of the loop, to speed up the ops.
			var index = 0;
			while (index < dataLength) {
				//Keep this loop small for speed.
				sixbits = [fromBase64.indexOf(data.charAt(index++)), fromBase64.indexOf(data.charAt(index++)), fromBase64.indexOf(data.charAt(index++)), fromBase64.indexOf(data.charAt(index++))];
				decode64 += String.fromCharCode((sixbits[0] << 2) | (sixbits[1] >> 4)) + String.fromCharCode(((sixbits[1] & 0x0F) << 4) | (sixbits[2] >> 2)) + String.fromCharCode(((sixbits[2] & 0x03) << 6) | sixbits[3]);
			}
			//Check for the '=' character after the loop, so we don't hose it up.
			if (sixbits[3] >= 0x40) {
				decode64.length -= 1;
				if (sixbits[2] >= 0x40) {
后面还有 16 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。