Add files via upload
This commit is contained in:
@@ -0,0 +1 @@
|
||||
h36A5I5KdeB29zb3iwNWVzxKkdwv2/ti98gYthE7u6y1nYTbOe15d0J9cUJ9VGg9ltPU2Xekoetpvsp1bJOPdrxV1j9SGOrGcaQDLJ8RT+0eITT9K+QRq6soWD0PcFNDK1qO8pgjU204a9tL/+SazyRz8rkV3rxm2OoegzhP9fHkDQqMWB0UNqnLjnGRd2c/1ARyel0eCNFSv/2v342617QvCf8CpzK23nbunblg4bE/FQ3lSIvG2jfaDd1KmT30ciD1bGzP8CtxUq59fHZy2Qm8rABqdjSdJ2CIwrVa2VJI3TdjEhtvXZoCI3QMe+RHzGmzo/WMEO4EUzdaGYCcXxIZvt20vRL/2xvWguKCE9mjDH6RbhGJ2X4YiSZiR1RxvyqLGoZsHeb6+ARHaJDLPmuitFfnUiUJ0GCy2V8nXsSaseebcYnMHcgM8ABjyzVe3C9vuoW8BpJ4s5x7TSxNNWw8r4c0LP8FS0GCuwF3YKnoIg5ZBGbJTihFGKQaMfUgpy2xX50zb9fGoxgFUuFJMWoyj9c5Z4pqn0DhDtKJf0x8IuGCPqfe9vzZLrqQWV0FJkcLg/XWzyRZ3yCOa2RcUHx7JoGpgkHh1Skpbl7gIamqIzq069xErFzHtgo05/SocMoeeDoeaVq0INkW8uHOIrDrmL0NQ3fKaMvyJnnKFsXY2iMy5n0MlwqcKEFqXjYql9oVu8Jhu+Yn46paaLOwpwrmVUqodl3Uq6gzEK82EAf6OditOQnpT6Tanc0T3hailiV/qm8LxIqetVItS0Lqkpwea3bf8lTR0oTxGYHHDSBAJ3Q8OZdWMo0loPHZIJKz92q+qseUHRgN4tqLgvKBQ+3Kl2TGAnjXqG7TKdCpeNzPpZOoVoXCnuzl9fR+3AFygHVCNJMrmullIVIE2eDBR6ASkQ1RtTfTGQiAUtJVT3zXgAvetqSYNB2AdN9l5cac38+Gz/YoqvcYyZ0PKMf/hCWIW/e4MzA7EsX/dpmLMaxd9D3RTYblNxXI0Mqw+48pazBAarCuS78dOPvb03DIiVQDx40OZVGjM2K90cbHYffbDqvV1KHr8vt7vgtPhX0pujlvaYnauHz9mL2cXeZ9B3vCHXGtlpmTsl5zVURuMrPBPLUgV5wZ7OMt2QsrQMd7Wy2WWFR+wRy9jwsbeloiCb09pn3jZJ8Sd4uAnsdKeEQ19uvu1ZbakWv2SWPOZNzNBY7OFAJOYmtcfKpcKzeIvio9zlu3UUCLsLw/EHuiup598PDUi7RJ0hCz5pm8OEcrqCTbheRS8OtPwU1Ym1CrMU78ErpxK3nUyl+faC14c1o7Odo1TCz/yGaxcnlgrQcvGvTTlITePjWwl0ygL6L6Lp8VVgkzHN3srM8nBkxg+/Ao/s2lGpYuBhPeELbYNlZJyeaEBZ8KBnvyKZi+iHPyT8TwjXQKpjg5S73Ug7THu92g5cXPhKspGDncTxGpBXYRLbcICJOS0L5rZeS6xBprw7TCLaWyvuIG5LzDO+L7+7bJeC3KL/k1jRm/46yI6Ex3S6YHMeFwkfYLhFndDzsCMMBs/CJBh6OYFODVcU6G4S2hUKQ1w6rQCH2qqzcQmBXu/dqAMULptaRYLwzifKuu/pEoKbVrErfvGVpr+GjgXdkQGl5LsBeZGKT9+byzWBIUnxIAU/T19YYM7F02QrrDp+uZE+WUmOe5+XagRQBo6x0hezXRW5bdX5RcIZs6eaU9K97H1SntB15U7Va7V48P84GFaGvT1jH9UGdkKjGVfJO1uw3cgBOHZfEs19JB5Kdy1sj9MMaFEh9yk+17KGQR81FBD30LYYy9Vyzl44YN/EOza00ledZe1faS8c1Wtx7S4AKUhs/s1U4UZIaZ9l/FS2JLYbeF/JdLT8AFEeq6aCTGVFRMqULHazR7FZtT+k5JZsR3Y/M5nqKwJbQYMAJQYdEjon+acmmD7Y0pWOszomcnWwx5RyIZvVu/crfaWl3FiCdopS1wt9+6RD2Kx5scQdHogS/7VUE+AyYaYPLiEvlodydOiKZfavvk24EVYawpZineuEQADRoYbGf2eME10ZtYx5+gbASN50uMXvzr0DT79J8guj5p0oE4s3a2kh4fUMrCdMxC4S/GKX4jaJ+/q8WzAtIj77z5FU4rlMOm0CzFPJwWyIF1YmL4p4C+Oi2xbYzFY05R0lO/+uCHwSrF6w==
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"规则名": "DJ呦呦音乐网",
|
||||
"规则作者": "",
|
||||
"请求头参数": "电脑",
|
||||
"网页编码格式": "UTF-8",
|
||||
"图片是否需要代理": "0",
|
||||
"是否开启获取首页数据": "1",
|
||||
"首页推荐链接": "http://www.djuu.com",
|
||||
"首页列表数组规则": "body&&.recommended-list",
|
||||
"首页片单列表数组规则": "li",
|
||||
"首页片单是否Jsoup写法": "1",
|
||||
"首页片单标题": ".index-music-title&&Text",
|
||||
"首页片单链接": "a&&href",
|
||||
"首页片单图片": "img&&src",
|
||||
"首页片单副标题": ".index-music-hit&&b&&Text",
|
||||
"首页片单链接加前缀": "http://www.djuu.com",
|
||||
"首页片单链接加后缀": "",
|
||||
"分类起始页码": "1",
|
||||
"分类链接": "http://www.djuu.com/{cateId}_{catePg}.html",
|
||||
"分类名称": "独家舞曲&迪高串烧&中文串烧&外语串烧&中英串烧&喊麦串烧&慢摇串烧&中文串烧&外语串烧&中英串烧&酒吧串烧&喊麦串烧&慢歌串烧&中文慢歌&外语慢歌&中英慢歌&中文Remix&Club&Electro&ProgHouse&VinaHouse&Funky/FunkyHouse&Melbourne&ElectroHouse&Bounce/Vina Bounce&车载版&更多...&外文Remix&中国风&越南鼓&车载版&HOUSE&Electro/Vina/Bass&Bounce/Vina&DeepHouse&FunkyHouse&ProgHouse&BounceHouse&ElectroDutch&ElectroMelbourne&Speed/ClubHouse&TechHouse/Vocal&Nudisco/DiscoHouse&Future/Bigroom/Edm&更多...&霓虹风格&HipHop&RnB&Funky/Rap&Trap&Rock&Pop&Reggae/Moombah&Dubstep&DanceHall&BreakBeat&暖场&蓝调&中文&更多...&Mashup&Mashup&PartyBreak&E.D.M&Remixes&变速/反差&更多...&中文DISCO&国潮中文&DISCO&外文DISCO&Hardstyle/HardBounce&Disco/PopDance&PopTechno&TechnoTrance&更多...&交谊舞曲&快三&慢三&中三&快四&中四&慢四&平四&中慢四&并四&贴面慢四&伦巴&桑巴&六步&恰恰&慢中四&靠步&拉并&牛仔&探戈&摇并&兔子舞&十四步&三步踩&拉丁舞&广场舞&古特巴&慢伦巴&南京小拉&三十二步&更多...",
|
||||
"分类名称替换词": "exclusive/115&djlist/1&djlist/13&djlist/14&djlist/96&djlist/12&djlist/2&djlist/16&djlist/17&djlist/98&djlist/97&djlist/15&djlist/3&djlist/18&djlist/19&djlist/20&djlist/4&djlist/21&djlist/22&djlist/26&djlist/107&djlist/99&djlist/25&djlist/23&djlist/24&djlist/41&djlist/27&djlist/5&djlist/28&djlist/110&djlist/29&djlist/6&djlist/30&djlist/31&djlist/36&djlist/100&djlist/35&djlist/38&djlist/33&djlist/32&djlist/34&djlist/37&djlist/39&djlist/40&djlist/42&djlist/7&djlist/43&djlist/94&djlist/44&djlist/48&djlist/50&djlist/49&djlist/45&djlist/46&djlist/47&djlist/95&djlist/51&djlist/52&djlist/53&djlist/54&djlist/8&djlist/55&djlist/56&djlist/108&djlist/57&djlist/58&djlist/59&djlist/9&djlist/60&djlist/61&djlist/10&djlist/114&djlist/62&djlist/63&djlist/64&djlist/65&djlist/11&djlist/71&djlist/73&djlist/72&djlist/66&djlist/67&djlist/69&djlist/68&djlist/112&djlist/70&djlist/111&djlist/74&djlist/78&djlist/80&djlist/75&djlist/82&djlist/79&djlist/81&djlist/85&djlist/76&djlist/77&djlist/91&djlist/90&djlist/89&djlist/88&djlist/86&djlist/87&djlist/83&djlist/92&djlist/84&djlist/93",
|
||||
"筛选数据": {},
|
||||
//"筛选数据": "ext",
|
||||
//{cateId}
|
||||
"筛选子分类名称": "",
|
||||
"筛选子分类替换词": "",
|
||||
//{class}
|
||||
"筛选类型名称": "",
|
||||
"筛选类型替换词": "*",
|
||||
//{area}
|
||||
"筛选地区名称": "",
|
||||
"筛选地区替换词": "*",
|
||||
//{year}
|
||||
"筛选年份名称": "",
|
||||
"筛选年份替换词": "*",
|
||||
//{lang}
|
||||
"筛选语言名称": "",
|
||||
"筛选语言替换词": "*",
|
||||
//{by}
|
||||
"筛选排序名称": "时间&人气&评分",
|
||||
"筛选排序替换词": "time&hits&score",
|
||||
"分类截取模式": "1",
|
||||
"分类列表数组规则": ".list_musiclist&&tr:has(.isgood_list)",
|
||||
"分类片单是否Jsoup写法": "1",
|
||||
"分类片单标题": "a&&title",
|
||||
"分类片单链接": "a&&href",
|
||||
"分类片单图片": "img&&src",
|
||||
"分类片单副标题": ".sc_1&&Text",
|
||||
"分类片单链接加前缀": "http://www.djuu.com",
|
||||
"分类片单链接加后缀": "",
|
||||
"搜索请求头参数": "User-Agent$电脑",
|
||||
"搜索链接": "http://www.djuu.com/search?musicname={wd}&list=2&cid=0&page=1",
|
||||
"POST请求数据": "",
|
||||
"搜索截取模式": "1",
|
||||
"搜索列表数组规则": ".list_musiclist&&tr:has(.isgood_list)",
|
||||
"搜索片单是否Jsoup写法": "1",
|
||||
"搜索片单图片": "img&&src",
|
||||
"搜索片单标题": "a&&title",
|
||||
"搜索片单链接": "a&&href",
|
||||
"搜索片单副标题": ".sc_2&&Text",
|
||||
"搜索片单链接加前缀": "http://www.djuu.com",
|
||||
"搜索片单链接加后缀": "",
|
||||
"链接是否直接播放": "1",
|
||||
"直接播放链接加前缀": "",
|
||||
"直接播放链接加后缀": "",
|
||||
"直接播放直链视频请求头": "",
|
||||
"是否开启手动嗅探": "1",
|
||||
"手动嗅探视频链接关键词": ".mp4#.m4a#.mp3#.aac#.m3u8#.flv#video/tos",
|
||||
"手动嗅探视频链接过滤词": ".html#=http"
|
||||
}
|
||||
+6191
@@ -0,0 +1,6191 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory();
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define([], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
globalThis.CryptoJS = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
/*globals window, global, require*/
|
||||
|
||||
/**
|
||||
* CryptoJS core components.
|
||||
*/
|
||||
var CryptoJS = CryptoJS || (function (Math, undefined) {
|
||||
|
||||
var crypto;
|
||||
|
||||
// Native crypto from window (Browser)
|
||||
if (typeof window !== 'undefined' && window.crypto) {
|
||||
crypto = window.crypto;
|
||||
}
|
||||
|
||||
// Native crypto in web worker (Browser)
|
||||
if (typeof self !== 'undefined' && self.crypto) {
|
||||
crypto = self.crypto;
|
||||
}
|
||||
|
||||
// Native crypto from worker
|
||||
if (typeof globalThis !== 'undefined' && globalThis.crypto) {
|
||||
crypto = globalThis.crypto;
|
||||
}
|
||||
|
||||
// Native (experimental IE 11) crypto from window (Browser)
|
||||
if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
|
||||
crypto = window.msCrypto;
|
||||
}
|
||||
|
||||
// Native crypto from global (NodeJS)
|
||||
if (!crypto && typeof global !== 'undefined' && global.crypto) {
|
||||
crypto = global.crypto;
|
||||
}
|
||||
|
||||
// Native crypto import via require (NodeJS)
|
||||
if (!crypto && typeof require === 'function') {
|
||||
try {
|
||||
crypto = require('crypto');
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
/*
|
||||
* Cryptographically secure pseudorandom number generator
|
||||
*
|
||||
* As Math.random() is cryptographically not safe to use
|
||||
*/
|
||||
var cryptoSecureRandomInt = function () {
|
||||
if (crypto) {
|
||||
// Use getRandomValues method (Browser)
|
||||
if (typeof crypto.getRandomValues === 'function') {
|
||||
try {
|
||||
return crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
// Use randomBytes method (NodeJS)
|
||||
if (typeof crypto.randomBytes === 'function') {
|
||||
try {
|
||||
return crypto.randomBytes(4).readInt32LE();
|
||||
} catch (err) {}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('Native crypto module could not be used to get secure random number.');
|
||||
};
|
||||
|
||||
/*
|
||||
* Local polyfill of Object.create
|
||||
|
||||
*/
|
||||
var create = Object.create || (function () {
|
||||
function F() {}
|
||||
|
||||
return function (obj) {
|
||||
var subtype;
|
||||
|
||||
F.prototype = obj;
|
||||
|
||||
subtype = new F();
|
||||
|
||||
F.prototype = null;
|
||||
|
||||
return subtype;
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* CryptoJS namespace.
|
||||
*/
|
||||
var C = {};
|
||||
|
||||
/**
|
||||
* Library namespace.
|
||||
*/
|
||||
var C_lib = C.lib = {};
|
||||
|
||||
/**
|
||||
* Base object for prototypal inheritance.
|
||||
*/
|
||||
var Base = C_lib.Base = (function () {
|
||||
|
||||
|
||||
return {
|
||||
/**
|
||||
* Creates a new object that inherits from this object.
|
||||
*
|
||||
* @param {Object} overrides Properties to copy into the new object.
|
||||
*
|
||||
* @return {Object} The new object.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var MyType = CryptoJS.lib.Base.extend({
|
||||
* field: 'value',
|
||||
*
|
||||
* method: function () {
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
extend: function (overrides) {
|
||||
// Spawn
|
||||
var subtype = create(this);
|
||||
|
||||
// Augment
|
||||
if (overrides) {
|
||||
subtype.mixIn(overrides);
|
||||
}
|
||||
|
||||
// Create default initializer
|
||||
if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
|
||||
subtype.init = function () {
|
||||
subtype.$super.init.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
// Initializer's prototype is the subtype object
|
||||
subtype.init.prototype = subtype;
|
||||
|
||||
// Reference supertype
|
||||
subtype.$super = this;
|
||||
|
||||
return subtype;
|
||||
},
|
||||
|
||||
/**
|
||||
* Extends this object and runs the init method.
|
||||
* Arguments to create() will be passed to init().
|
||||
*
|
||||
* @return {Object} The new object.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var instance = MyType.create();
|
||||
*/
|
||||
create: function () {
|
||||
var instance = this.extend();
|
||||
instance.init.apply(instance, arguments);
|
||||
|
||||
return instance;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes a newly created object.
|
||||
* Override this method to add some logic when your objects are created.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var MyType = CryptoJS.lib.Base.extend({
|
||||
* init: function () {
|
||||
* // ...
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
init: function () {
|
||||
},
|
||||
|
||||
/**
|
||||
* Copies properties into this object.
|
||||
*
|
||||
* @param {Object} properties The properties to mix in.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* MyType.mixIn({
|
||||
* field: 'value'
|
||||
* });
|
||||
*/
|
||||
mixIn: function (properties) {
|
||||
for (var propertyName in properties) {
|
||||
if (properties.hasOwnProperty(propertyName)) {
|
||||
this[propertyName] = properties[propertyName];
|
||||
}
|
||||
}
|
||||
|
||||
// IE won't copy toString using the loop above
|
||||
if (properties.hasOwnProperty('toString')) {
|
||||
this.toString = properties.toString;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a copy of this object.
|
||||
*
|
||||
* @return {Object} The clone.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var clone = instance.clone();
|
||||
*/
|
||||
clone: function () {
|
||||
return this.init.prototype.extend(this);
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* An array of 32-bit words.
|
||||
*
|
||||
* @property {Array} words The array of 32-bit words.
|
||||
* @property {number} sigBytes The number of significant bytes in this word array.
|
||||
*/
|
||||
var WordArray = C_lib.WordArray = Base.extend({
|
||||
/**
|
||||
* Initializes a newly created word array.
|
||||
*
|
||||
* @param {Array} words (Optional) An array of 32-bit words.
|
||||
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.lib.WordArray.create();
|
||||
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
||||
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
||||
*/
|
||||
init: function (words, sigBytes) {
|
||||
words = this.words = words || [];
|
||||
|
||||
if (sigBytes != undefined) {
|
||||
this.sigBytes = sigBytes;
|
||||
} else {
|
||||
this.sigBytes = words.length * 4;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts this word array to a string.
|
||||
*
|
||||
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
|
||||
*
|
||||
* @return {string} The stringified word array.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var string = wordArray + '';
|
||||
* var string = wordArray.toString();
|
||||
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
||||
*/
|
||||
toString: function (encoder) {
|
||||
return (encoder || Hex).stringify(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Concatenates a word array to this word array.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array to append.
|
||||
*
|
||||
* @return {WordArray} This word array.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* wordArray1.concat(wordArray2);
|
||||
*/
|
||||
concat: function (wordArray) {
|
||||
// Shortcuts
|
||||
var thisWords = this.words;
|
||||
var thatWords = wordArray.words;
|
||||
var thisSigBytes = this.sigBytes;
|
||||
var thatSigBytes = wordArray.sigBytes;
|
||||
|
||||
// Clamp excess bits
|
||||
this.clamp();
|
||||
|
||||
// Concat
|
||||
if (thisSigBytes % 4) {
|
||||
// Copy one byte at a time
|
||||
for (var i = 0; i < thatSigBytes; i++) {
|
||||
var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||
thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
|
||||
}
|
||||
} else {
|
||||
// Copy one word at a time
|
||||
for (var j = 0; j < thatSigBytes; j += 4) {
|
||||
thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
|
||||
}
|
||||
}
|
||||
this.sigBytes += thatSigBytes;
|
||||
|
||||
// Chainable
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes insignificant bits.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* wordArray.clamp();
|
||||
*/
|
||||
clamp: function () {
|
||||
// Shortcuts
|
||||
var words = this.words;
|
||||
var sigBytes = this.sigBytes;
|
||||
|
||||
// Clamp
|
||||
words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
|
||||
words.length = Math.ceil(sigBytes / 4);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a copy of this word array.
|
||||
*
|
||||
* @return {WordArray} The clone.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var clone = wordArray.clone();
|
||||
*/
|
||||
clone: function () {
|
||||
var clone = Base.clone.call(this);
|
||||
clone.words = this.words.slice(0);
|
||||
|
||||
return clone;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a word array filled with random bytes.
|
||||
*
|
||||
* @param {number} nBytes The number of random bytes to generate.
|
||||
*
|
||||
* @return {WordArray} The random word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
||||
*/
|
||||
random: function (nBytes) {
|
||||
var words = [];
|
||||
|
||||
for (var i = 0; i < nBytes; i += 4) {
|
||||
words.push(cryptoSecureRandomInt());
|
||||
}
|
||||
|
||||
return new WordArray.init(words, nBytes);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Encoder namespace.
|
||||
*/
|
||||
var C_enc = C.enc = {};
|
||||
|
||||
/**
|
||||
* Hex encoding strategy.
|
||||
*/
|
||||
var Hex = C_enc.Hex = {
|
||||
/**
|
||||
* Converts a word array to a hex string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @return {string} The hex string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray) {
|
||||
// Shortcuts
|
||||
var words = wordArray.words;
|
||||
var sigBytes = wordArray.sigBytes;
|
||||
|
||||
// Convert
|
||||
var hexChars = [];
|
||||
for (var i = 0; i < sigBytes; i++) {
|
||||
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||
hexChars.push((bite >>> 4).toString(16));
|
||||
hexChars.push((bite & 0x0f).toString(16));
|
||||
}
|
||||
|
||||
return hexChars.join('');
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a hex string to a word array.
|
||||
*
|
||||
* @param {string} hexStr The hex string.
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
||||
*/
|
||||
parse: function (hexStr) {
|
||||
// Shortcut
|
||||
var hexStrLength = hexStr.length;
|
||||
|
||||
// Convert
|
||||
var words = [];
|
||||
for (var i = 0; i < hexStrLength; i += 2) {
|
||||
words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
|
||||
}
|
||||
|
||||
return new WordArray.init(words, hexStrLength / 2);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Latin1 encoding strategy.
|
||||
*/
|
||||
var Latin1 = C_enc.Latin1 = {
|
||||
/**
|
||||
* Converts a word array to a Latin1 string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @return {string} The Latin1 string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray) {
|
||||
// Shortcuts
|
||||
var words = wordArray.words;
|
||||
var sigBytes = wordArray.sigBytes;
|
||||
|
||||
// Convert
|
||||
var latin1Chars = [];
|
||||
for (var i = 0; i < sigBytes; i++) {
|
||||
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||
latin1Chars.push(String.fromCharCode(bite));
|
||||
}
|
||||
|
||||
return latin1Chars.join('');
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a Latin1 string to a word array.
|
||||
*
|
||||
* @param {string} latin1Str The Latin1 string.
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
||||
*/
|
||||
parse: function (latin1Str) {
|
||||
// Shortcut
|
||||
var latin1StrLength = latin1Str.length;
|
||||
|
||||
// Convert
|
||||
var words = [];
|
||||
for (var i = 0; i < latin1StrLength; i++) {
|
||||
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
|
||||
}
|
||||
|
||||
return new WordArray.init(words, latin1StrLength);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* UTF-8 encoding strategy.
|
||||
*/
|
||||
var Utf8 = C_enc.Utf8 = {
|
||||
/**
|
||||
* Converts a word array to a UTF-8 string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @return {string} The UTF-8 string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray) {
|
||||
try {
|
||||
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
||||
} catch (e) {
|
||||
throw new Error('Malformed UTF-8 data');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a UTF-8 string to a word array.
|
||||
*
|
||||
* @param {string} utf8Str The UTF-8 string.
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
||||
*/
|
||||
parse: function (utf8Str) {
|
||||
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract buffered block algorithm template.
|
||||
*
|
||||
* The property blockSize must be implemented in a concrete subtype.
|
||||
*
|
||||
* @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
|
||||
*/
|
||||
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
||||
/**
|
||||
* Resets this block algorithm's data buffer to its initial state.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* bufferedBlockAlgorithm.reset();
|
||||
*/
|
||||
reset: function () {
|
||||
// Initial values
|
||||
this._data = new WordArray.init();
|
||||
this._nDataBytes = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds new data to this block algorithm's buffer.
|
||||
*
|
||||
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* bufferedBlockAlgorithm._append('data');
|
||||
* bufferedBlockAlgorithm._append(wordArray);
|
||||
*/
|
||||
_append: function (data) {
|
||||
// Convert string to WordArray, else assume WordArray already
|
||||
if (typeof data == 'string') {
|
||||
data = Utf8.parse(data);
|
||||
}
|
||||
|
||||
// Append
|
||||
this._data.concat(data);
|
||||
this._nDataBytes += data.sigBytes;
|
||||
},
|
||||
|
||||
/**
|
||||
* Processes available data blocks.
|
||||
*
|
||||
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
|
||||
*
|
||||
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
|
||||
*
|
||||
* @return {WordArray} The processed data.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var processedData = bufferedBlockAlgorithm._process();
|
||||
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
||||
*/
|
||||
_process: function (doFlush) {
|
||||
var processedWords;
|
||||
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
var dataSigBytes = data.sigBytes;
|
||||
var blockSize = this.blockSize;
|
||||
var blockSizeBytes = blockSize * 4;
|
||||
|
||||
// Count blocks ready
|
||||
var nBlocksReady = dataSigBytes / blockSizeBytes;
|
||||
if (doFlush) {
|
||||
// Round up to include partial blocks
|
||||
nBlocksReady = Math.ceil(nBlocksReady);
|
||||
} else {
|
||||
// Round down to include only full blocks,
|
||||
// less the number of blocks that must remain in the buffer
|
||||
nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
|
||||
}
|
||||
|
||||
// Count words ready
|
||||
var nWordsReady = nBlocksReady * blockSize;
|
||||
|
||||
// Count bytes ready
|
||||
var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
|
||||
|
||||
// Process blocks
|
||||
if (nWordsReady) {
|
||||
for (var offset = 0; offset < nWordsReady; offset += blockSize) {
|
||||
// Perform concrete-algorithm logic
|
||||
this._doProcessBlock(dataWords, offset);
|
||||
}
|
||||
|
||||
// Remove processed words
|
||||
processedWords = dataWords.splice(0, nWordsReady);
|
||||
data.sigBytes -= nBytesReady;
|
||||
}
|
||||
|
||||
// Return processed words
|
||||
return new WordArray.init(processedWords, nBytesReady);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a copy of this object.
|
||||
*
|
||||
* @return {Object} The clone.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var clone = bufferedBlockAlgorithm.clone();
|
||||
*/
|
||||
clone: function () {
|
||||
var clone = Base.clone.call(this);
|
||||
clone._data = this._data.clone();
|
||||
|
||||
return clone;
|
||||
},
|
||||
|
||||
_minBufferSize: 0
|
||||
});
|
||||
|
||||
/**
|
||||
* Abstract hasher template.
|
||||
*
|
||||
* @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
|
||||
*/
|
||||
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*/
|
||||
cfg: Base.extend(),
|
||||
|
||||
/**
|
||||
* Initializes a newly created hasher.
|
||||
*
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hasher = CryptoJS.algo.SHA256.create();
|
||||
*/
|
||||
init: function (cfg) {
|
||||
// Apply config defaults
|
||||
this.cfg = this.cfg.extend(cfg);
|
||||
|
||||
// Set initial values
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets this hasher to its initial state.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* hasher.reset();
|
||||
*/
|
||||
reset: function () {
|
||||
// Reset data buffer
|
||||
BufferedBlockAlgorithm.reset.call(this);
|
||||
|
||||
// Perform concrete-hasher logic
|
||||
this._doReset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates this hasher with a message.
|
||||
*
|
||||
* @param {WordArray|string} messageUpdate The message to append.
|
||||
*
|
||||
* @return {Hasher} This hasher.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* hasher.update('message');
|
||||
* hasher.update(wordArray);
|
||||
*/
|
||||
update: function (messageUpdate) {
|
||||
// Append
|
||||
this._append(messageUpdate);
|
||||
|
||||
// Update the hash
|
||||
this._process();
|
||||
|
||||
// Chainable
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Finalizes the hash computation.
|
||||
* Note that the finalize operation is effectively a destructive, read-once operation.
|
||||
*
|
||||
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = hasher.finalize();
|
||||
* var hash = hasher.finalize('message');
|
||||
* var hash = hasher.finalize(wordArray);
|
||||
*/
|
||||
finalize: function (messageUpdate) {
|
||||
// Final message update
|
||||
if (messageUpdate) {
|
||||
this._append(messageUpdate);
|
||||
}
|
||||
|
||||
// Perform concrete-hasher logic
|
||||
var hash = this._doFinalize();
|
||||
|
||||
return hash;
|
||||
},
|
||||
|
||||
blockSize: 512/32,
|
||||
|
||||
/**
|
||||
* Creates a shortcut function to a hasher's object interface.
|
||||
*
|
||||
* @param {Hasher} hasher The hasher to create a helper for.
|
||||
*
|
||||
* @return {Function} The shortcut function.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
||||
*/
|
||||
_createHelper: function (hasher) {
|
||||
return function (message, cfg) {
|
||||
return new hasher.init(cfg).finalize(message);
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {Hasher} hasher The hasher to use in this HMAC helper.
|
||||
*
|
||||
* @return {Function} The shortcut function.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
||||
*/
|
||||
_createHmacHelper: function (hasher) {
|
||||
return function (message, key) {
|
||||
return new C_algo.HMAC.init(hasher, key).finalize(message);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Algorithm namespace.
|
||||
*/
|
||||
var C_algo = C.algo = {};
|
||||
|
||||
return C;
|
||||
}(Math));
|
||||
|
||||
|
||||
(function (undefined) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var Base = C_lib.Base;
|
||||
var X32WordArray = C_lib.WordArray;
|
||||
|
||||
/**
|
||||
* x64 namespace.
|
||||
*/
|
||||
var C_x64 = C.x64 = {};
|
||||
|
||||
/**
|
||||
* A 64-bit word.
|
||||
*/
|
||||
var X64Word = C_x64.Word = Base.extend({
|
||||
/**
|
||||
* Initializes a newly created 64-bit word.
|
||||
*
|
||||
* @param {number} high The high 32 bits.
|
||||
* @param {number} low The low 32 bits.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
|
||||
*/
|
||||
init: function (high, low) {
|
||||
this.high = high;
|
||||
this.low = low;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bitwise NOTs this word.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after negating.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var negated = x64Word.not();
|
||||
*/
|
||||
// not: function () {
|
||||
// var high = ~this.high;
|
||||
// var low = ~this.low;
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// },
|
||||
|
||||
/**
|
||||
* Bitwise ANDs this word with the passed word.
|
||||
*
|
||||
* @param {X64Word} word The x64-Word to AND with this word.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after ANDing.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var anded = x64Word.and(anotherX64Word);
|
||||
*/
|
||||
// and: function (word) {
|
||||
// var high = this.high & word.high;
|
||||
// var low = this.low & word.low;
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// },
|
||||
|
||||
/**
|
||||
* Bitwise ORs this word with the passed word.
|
||||
*
|
||||
* @param {X64Word} word The x64-Word to OR with this word.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after ORing.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ored = x64Word.or(anotherX64Word);
|
||||
*/
|
||||
// or: function (word) {
|
||||
// var high = this.high | word.high;
|
||||
// var low = this.low | word.low;
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// },
|
||||
|
||||
/**
|
||||
* Bitwise XORs this word with the passed word.
|
||||
*
|
||||
* @param {X64Word} word The x64-Word to XOR with this word.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after XORing.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var xored = x64Word.xor(anotherX64Word);
|
||||
*/
|
||||
// xor: function (word) {
|
||||
// var high = this.high ^ word.high;
|
||||
// var low = this.low ^ word.low;
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// },
|
||||
|
||||
/**
|
||||
* Shifts this word n bits to the left.
|
||||
*
|
||||
* @param {number} n The number of bits to shift.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after shifting.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var shifted = x64Word.shiftL(25);
|
||||
*/
|
||||
// shiftL: function (n) {
|
||||
// if (n < 32) {
|
||||
// var high = (this.high << n) | (this.low >>> (32 - n));
|
||||
// var low = this.low << n;
|
||||
// } else {
|
||||
// var high = this.low << (n - 32);
|
||||
// var low = 0;
|
||||
// }
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// },
|
||||
|
||||
/**
|
||||
* Shifts this word n bits to the right.
|
||||
*
|
||||
* @param {number} n The number of bits to shift.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after shifting.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var shifted = x64Word.shiftR(7);
|
||||
*/
|
||||
// shiftR: function (n) {
|
||||
// if (n < 32) {
|
||||
// var low = (this.low >>> n) | (this.high << (32 - n));
|
||||
// var high = this.high >>> n;
|
||||
// } else {
|
||||
// var low = this.high >>> (n - 32);
|
||||
// var high = 0;
|
||||
// }
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// },
|
||||
|
||||
/**
|
||||
* Rotates this word n bits to the left.
|
||||
*
|
||||
* @param {number} n The number of bits to rotate.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after rotating.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var rotated = x64Word.rotL(25);
|
||||
*/
|
||||
// rotL: function (n) {
|
||||
// return this.shiftL(n).or(this.shiftR(64 - n));
|
||||
// },
|
||||
|
||||
/**
|
||||
* Rotates this word n bits to the right.
|
||||
*
|
||||
* @param {number} n The number of bits to rotate.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after rotating.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var rotated = x64Word.rotR(7);
|
||||
*/
|
||||
// rotR: function (n) {
|
||||
// return this.shiftR(n).or(this.shiftL(64 - n));
|
||||
// },
|
||||
|
||||
/**
|
||||
* Adds this word with the passed word.
|
||||
*
|
||||
* @param {X64Word} word The x64-Word to add with this word.
|
||||
*
|
||||
* @return {X64Word} A new x64-Word object after adding.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var added = x64Word.add(anotherX64Word);
|
||||
*/
|
||||
// add: function (word) {
|
||||
// var low = (this.low + word.low) | 0;
|
||||
// var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
|
||||
// var high = (this.high + word.high + carry) | 0;
|
||||
|
||||
// return X64Word.create(high, low);
|
||||
// }
|
||||
});
|
||||
|
||||
/**
|
||||
* An array of 64-bit words.
|
||||
*
|
||||
* @property {Array} words The array of CryptoJS.x64.Word objects.
|
||||
* @property {number} sigBytes The number of significant bytes in this word array.
|
||||
*/
|
||||
var X64WordArray = C_x64.WordArray = Base.extend({
|
||||
/**
|
||||
* Initializes a newly created word array.
|
||||
*
|
||||
* @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
|
||||
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.x64.WordArray.create();
|
||||
*
|
||||
* var wordArray = CryptoJS.x64.WordArray.create([
|
||||
* CryptoJS.x64.Word.create(0x00010203, 0x04050607),
|
||||
* CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
|
||||
* ]);
|
||||
*
|
||||
* var wordArray = CryptoJS.x64.WordArray.create([
|
||||
* CryptoJS.x64.Word.create(0x00010203, 0x04050607),
|
||||
* CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
|
||||
* ], 10);
|
||||
*/
|
||||
init: function (words, sigBytes) {
|
||||
words = this.words = words || [];
|
||||
|
||||
if (sigBytes != undefined) {
|
||||
this.sigBytes = sigBytes;
|
||||
} else {
|
||||
this.sigBytes = words.length * 8;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts this 64-bit word array to a 32-bit word array.
|
||||
*
|
||||
* @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var x32WordArray = x64WordArray.toX32();
|
||||
*/
|
||||
toX32: function () {
|
||||
// Shortcuts
|
||||
var x64Words = this.words;
|
||||
var x64WordsLength = x64Words.length;
|
||||
|
||||
// Convert
|
||||
var x32Words = [];
|
||||
for (var i = 0; i < x64WordsLength; i++) {
|
||||
var x64Word = x64Words[i];
|
||||
x32Words.push(x64Word.high);
|
||||
x32Words.push(x64Word.low);
|
||||
}
|
||||
|
||||
return X32WordArray.create(x32Words, this.sigBytes);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a copy of this word array.
|
||||
*
|
||||
* @return {X64WordArray} The clone.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var clone = x64WordArray.clone();
|
||||
*/
|
||||
clone: function () {
|
||||
var clone = Base.clone.call(this);
|
||||
|
||||
// Clone "words" array
|
||||
var words = clone.words = this.words.slice(0);
|
||||
|
||||
// Clone each X64Word object
|
||||
var wordsLength = words.length;
|
||||
for (var i = 0; i < wordsLength; i++) {
|
||||
words[i] = words[i].clone();
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Check if typed arrays are supported
|
||||
if (typeof ArrayBuffer != 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
|
||||
// Reference original init
|
||||
var superInit = WordArray.init;
|
||||
|
||||
// Augment WordArray.init to handle typed arrays
|
||||
var subInit = WordArray.init = function (typedArray) {
|
||||
// Convert buffers to uint8
|
||||
if (typedArray instanceof ArrayBuffer) {
|
||||
typedArray = new Uint8Array(typedArray);
|
||||
}
|
||||
|
||||
// Convert other array views to uint8
|
||||
if (
|
||||
typedArray instanceof Int8Array ||
|
||||
(typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
|
||||
typedArray instanceof Int16Array ||
|
||||
typedArray instanceof Uint16Array ||
|
||||
typedArray instanceof Int32Array ||
|
||||
typedArray instanceof Uint32Array ||
|
||||
typedArray instanceof Float32Array ||
|
||||
typedArray instanceof Float64Array
|
||||
) {
|
||||
typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
|
||||
}
|
||||
|
||||
// Handle Uint8Array
|
||||
if (typedArray instanceof Uint8Array) {
|
||||
// Shortcut
|
||||
var typedArrayByteLength = typedArray.byteLength;
|
||||
|
||||
// Extract bytes
|
||||
var words = [];
|
||||
for (var i = 0; i < typedArrayByteLength; i++) {
|
||||
words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
|
||||
}
|
||||
|
||||
// Initialize this word array
|
||||
superInit.call(this, words, typedArrayByteLength);
|
||||
} else {
|
||||
// Else call normal init
|
||||
superInit.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
subInit.prototype = WordArray;
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var C_enc = C.enc;
|
||||
|
||||
/**
|
||||
* UTF-16 BE encoding strategy.
|
||||
*/
|
||||
var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
|
||||
/**
|
||||
* Converts a word array to a UTF-16 BE string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @return {string} The UTF-16 BE string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray) {
|
||||
// Shortcuts
|
||||
var words = wordArray.words;
|
||||
var sigBytes = wordArray.sigBytes;
|
||||
|
||||
// Convert
|
||||
var utf16Chars = [];
|
||||
for (var i = 0; i < sigBytes; i += 2) {
|
||||
var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
|
||||
utf16Chars.push(String.fromCharCode(codePoint));
|
||||
}
|
||||
|
||||
return utf16Chars.join('');
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a UTF-16 BE string to a word array.
|
||||
*
|
||||
* @param {string} utf16Str The UTF-16 BE string.
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
|
||||
*/
|
||||
parse: function (utf16Str) {
|
||||
// Shortcut
|
||||
var utf16StrLength = utf16Str.length;
|
||||
|
||||
// Convert
|
||||
var words = [];
|
||||
for (var i = 0; i < utf16StrLength; i++) {
|
||||
words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
|
||||
}
|
||||
|
||||
return WordArray.create(words, utf16StrLength * 2);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* UTF-16 LE encoding strategy.
|
||||
*/
|
||||
C_enc.Utf16LE = {
|
||||
/**
|
||||
* Converts a word array to a UTF-16 LE string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @return {string} The UTF-16 LE string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray) {
|
||||
// Shortcuts
|
||||
var words = wordArray.words;
|
||||
var sigBytes = wordArray.sigBytes;
|
||||
|
||||
// Convert
|
||||
var utf16Chars = [];
|
||||
for (var i = 0; i < sigBytes; i += 2) {
|
||||
var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
|
||||
utf16Chars.push(String.fromCharCode(codePoint));
|
||||
}
|
||||
|
||||
return utf16Chars.join('');
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a UTF-16 LE string to a word array.
|
||||
*
|
||||
* @param {string} utf16Str The UTF-16 LE string.
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
|
||||
*/
|
||||
parse: function (utf16Str) {
|
||||
// Shortcut
|
||||
var utf16StrLength = utf16Str.length;
|
||||
|
||||
// Convert
|
||||
var words = [];
|
||||
for (var i = 0; i < utf16StrLength; i++) {
|
||||
words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
|
||||
}
|
||||
|
||||
return WordArray.create(words, utf16StrLength * 2);
|
||||
}
|
||||
};
|
||||
|
||||
function swapEndian(word) {
|
||||
return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
|
||||
}
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var C_enc = C.enc;
|
||||
|
||||
/**
|
||||
* Base64 encoding strategy.
|
||||
*/
|
||||
var Base64 = C_enc.Base64 = {
|
||||
/**
|
||||
* Converts a word array to a Base64 string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @return {string} The Base64 string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var base64String = CryptoJS.enc.Base64.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray) {
|
||||
// Shortcuts
|
||||
var words = wordArray.words;
|
||||
var sigBytes = wordArray.sigBytes;
|
||||
var map = this._map;
|
||||
|
||||
// Clamp excess bits
|
||||
wordArray.clamp();
|
||||
|
||||
// Convert
|
||||
var base64Chars = [];
|
||||
for (var i = 0; i < sigBytes; i += 3) {
|
||||
var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||
var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
|
||||
var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
|
||||
|
||||
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
||||
|
||||
for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
||||
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
||||
}
|
||||
}
|
||||
|
||||
// Add padding
|
||||
var paddingChar = map.charAt(64);
|
||||
if (paddingChar) {
|
||||
while (base64Chars.length % 4) {
|
||||
base64Chars.push(paddingChar);
|
||||
}
|
||||
}
|
||||
|
||||
return base64Chars.join('');
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a Base64 string to a word array.
|
||||
*
|
||||
* @param {string} base64Str The Base64 string.
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Base64.parse(base64String);
|
||||
*/
|
||||
parse: function (base64Str) {
|
||||
// Shortcuts
|
||||
var base64StrLength = base64Str.length;
|
||||
var map = this._map;
|
||||
var reverseMap = this._reverseMap;
|
||||
|
||||
if (!reverseMap) {
|
||||
reverseMap = this._reverseMap = [];
|
||||
for (var j = 0; j < map.length; j++) {
|
||||
reverseMap[map.charCodeAt(j)] = j;
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore padding
|
||||
var paddingChar = map.charAt(64);
|
||||
if (paddingChar) {
|
||||
var paddingIndex = base64Str.indexOf(paddingChar);
|
||||
if (paddingIndex !== -1) {
|
||||
base64StrLength = paddingIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert
|
||||
return parseLoop(base64Str, base64StrLength, reverseMap);
|
||||
|
||||
},
|
||||
|
||||
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
};
|
||||
|
||||
function parseLoop(base64Str, base64StrLength, reverseMap) {
|
||||
var words = [];
|
||||
var nBytes = 0;
|
||||
for (var i = 0; i < base64StrLength; i++) {
|
||||
if (i % 4) {
|
||||
var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
|
||||
var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
|
||||
var bitsCombined = bits1 | bits2;
|
||||
words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
|
||||
nBytes++;
|
||||
}
|
||||
}
|
||||
return WordArray.create(words, nBytes);
|
||||
}
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var C_enc = C.enc;
|
||||
|
||||
/**
|
||||
* Base64url encoding strategy.
|
||||
*/
|
||||
var Base64url = C_enc.Base64url = {
|
||||
/**
|
||||
* Converts a word array to a Base64url string.
|
||||
*
|
||||
* @param {WordArray} wordArray The word array.
|
||||
*
|
||||
* @param {boolean} urlSafe Whether to use url safe
|
||||
*
|
||||
* @return {string} The Base64url string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
|
||||
*/
|
||||
stringify: function (wordArray, urlSafe=true) {
|
||||
// Shortcuts
|
||||
var words = wordArray.words;
|
||||
var sigBytes = wordArray.sigBytes;
|
||||
var map = urlSafe ? this._safe_map : this._map;
|
||||
|
||||
// Clamp excess bits
|
||||
wordArray.clamp();
|
||||
|
||||
// Convert
|
||||
var base64Chars = [];
|
||||
for (var i = 0; i < sigBytes; i += 3) {
|
||||
var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||
var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
|
||||
var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
|
||||
|
||||
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
||||
|
||||
for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
||||
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
||||
}
|
||||
}
|
||||
|
||||
// Add padding
|
||||
var paddingChar = map.charAt(64);
|
||||
if (paddingChar) {
|
||||
while (base64Chars.length % 4) {
|
||||
base64Chars.push(paddingChar);
|
||||
}
|
||||
}
|
||||
|
||||
return base64Chars.join('');
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a Base64url string to a word array.
|
||||
*
|
||||
* @param {string} base64Str The Base64url string.
|
||||
*
|
||||
* @param {boolean} urlSafe Whether to use url safe
|
||||
*
|
||||
* @return {WordArray} The word array.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var wordArray = CryptoJS.enc.Base64url.parse(base64String);
|
||||
*/
|
||||
parse: function (base64Str, urlSafe=true) {
|
||||
// Shortcuts
|
||||
var base64StrLength = base64Str.length;
|
||||
var map = urlSafe ? this._safe_map : this._map;
|
||||
var reverseMap = this._reverseMap;
|
||||
|
||||
if (!reverseMap) {
|
||||
reverseMap = this._reverseMap = [];
|
||||
for (var j = 0; j < map.length; j++) {
|
||||
reverseMap[map.charCodeAt(j)] = j;
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore padding
|
||||
var paddingChar = map.charAt(64);
|
||||
if (paddingChar) {
|
||||
var paddingIndex = base64Str.indexOf(paddingChar);
|
||||
if (paddingIndex !== -1) {
|
||||
base64StrLength = paddingIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert
|
||||
return parseLoop(base64Str, base64StrLength, reverseMap);
|
||||
|
||||
},
|
||||
|
||||
_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||
_safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
|
||||
};
|
||||
|
||||
function parseLoop(base64Str, base64StrLength, reverseMap) {
|
||||
var words = [];
|
||||
var nBytes = 0;
|
||||
for (var i = 0; i < base64StrLength; i++) {
|
||||
if (i % 4) {
|
||||
var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
|
||||
var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
|
||||
var bitsCombined = bits1 | bits2;
|
||||
words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
|
||||
nBytes++;
|
||||
}
|
||||
}
|
||||
return WordArray.create(words, nBytes);
|
||||
}
|
||||
}());
|
||||
|
||||
(function (Math) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var Hasher = C_lib.Hasher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Constants table
|
||||
var T = [];
|
||||
|
||||
// Compute constants
|
||||
(function () {
|
||||
for (var i = 0; i < 64; i++) {
|
||||
T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
* MD5 hash algorithm.
|
||||
*/
|
||||
var MD5 = C_algo.MD5 = Hasher.extend({
|
||||
_doReset: function () {
|
||||
this._hash = new WordArray.init([
|
||||
0x67452301, 0xefcdab89,
|
||||
0x98badcfe, 0x10325476
|
||||
]);
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Swap endian
|
||||
for (var i = 0; i < 16; i++) {
|
||||
// Shortcuts
|
||||
var offset_i = offset + i;
|
||||
var M_offset_i = M[offset_i];
|
||||
|
||||
M[offset_i] = (
|
||||
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
||||
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
}
|
||||
|
||||
// Shortcuts
|
||||
var H = this._hash.words;
|
||||
|
||||
var M_offset_0 = M[offset + 0];
|
||||
var M_offset_1 = M[offset + 1];
|
||||
var M_offset_2 = M[offset + 2];
|
||||
var M_offset_3 = M[offset + 3];
|
||||
var M_offset_4 = M[offset + 4];
|
||||
var M_offset_5 = M[offset + 5];
|
||||
var M_offset_6 = M[offset + 6];
|
||||
var M_offset_7 = M[offset + 7];
|
||||
var M_offset_8 = M[offset + 8];
|
||||
var M_offset_9 = M[offset + 9];
|
||||
var M_offset_10 = M[offset + 10];
|
||||
var M_offset_11 = M[offset + 11];
|
||||
var M_offset_12 = M[offset + 12];
|
||||
var M_offset_13 = M[offset + 13];
|
||||
var M_offset_14 = M[offset + 14];
|
||||
var M_offset_15 = M[offset + 15];
|
||||
|
||||
// Working varialbes
|
||||
var a = H[0];
|
||||
var b = H[1];
|
||||
var c = H[2];
|
||||
var d = H[3];
|
||||
|
||||
// Computation
|
||||
a = FF(a, b, c, d, M_offset_0, 7, T[0]);
|
||||
d = FF(d, a, b, c, M_offset_1, 12, T[1]);
|
||||
c = FF(c, d, a, b, M_offset_2, 17, T[2]);
|
||||
b = FF(b, c, d, a, M_offset_3, 22, T[3]);
|
||||
a = FF(a, b, c, d, M_offset_4, 7, T[4]);
|
||||
d = FF(d, a, b, c, M_offset_5, 12, T[5]);
|
||||
c = FF(c, d, a, b, M_offset_6, 17, T[6]);
|
||||
b = FF(b, c, d, a, M_offset_7, 22, T[7]);
|
||||
a = FF(a, b, c, d, M_offset_8, 7, T[8]);
|
||||
d = FF(d, a, b, c, M_offset_9, 12, T[9]);
|
||||
c = FF(c, d, a, b, M_offset_10, 17, T[10]);
|
||||
b = FF(b, c, d, a, M_offset_11, 22, T[11]);
|
||||
a = FF(a, b, c, d, M_offset_12, 7, T[12]);
|
||||
d = FF(d, a, b, c, M_offset_13, 12, T[13]);
|
||||
c = FF(c, d, a, b, M_offset_14, 17, T[14]);
|
||||
b = FF(b, c, d, a, M_offset_15, 22, T[15]);
|
||||
|
||||
a = GG(a, b, c, d, M_offset_1, 5, T[16]);
|
||||
d = GG(d, a, b, c, M_offset_6, 9, T[17]);
|
||||
c = GG(c, d, a, b, M_offset_11, 14, T[18]);
|
||||
b = GG(b, c, d, a, M_offset_0, 20, T[19]);
|
||||
a = GG(a, b, c, d, M_offset_5, 5, T[20]);
|
||||
d = GG(d, a, b, c, M_offset_10, 9, T[21]);
|
||||
c = GG(c, d, a, b, M_offset_15, 14, T[22]);
|
||||
b = GG(b, c, d, a, M_offset_4, 20, T[23]);
|
||||
a = GG(a, b, c, d, M_offset_9, 5, T[24]);
|
||||
d = GG(d, a, b, c, M_offset_14, 9, T[25]);
|
||||
c = GG(c, d, a, b, M_offset_3, 14, T[26]);
|
||||
b = GG(b, c, d, a, M_offset_8, 20, T[27]);
|
||||
a = GG(a, b, c, d, M_offset_13, 5, T[28]);
|
||||
d = GG(d, a, b, c, M_offset_2, 9, T[29]);
|
||||
c = GG(c, d, a, b, M_offset_7, 14, T[30]);
|
||||
b = GG(b, c, d, a, M_offset_12, 20, T[31]);
|
||||
|
||||
a = HH(a, b, c, d, M_offset_5, 4, T[32]);
|
||||
d = HH(d, a, b, c, M_offset_8, 11, T[33]);
|
||||
c = HH(c, d, a, b, M_offset_11, 16, T[34]);
|
||||
b = HH(b, c, d, a, M_offset_14, 23, T[35]);
|
||||
a = HH(a, b, c, d, M_offset_1, 4, T[36]);
|
||||
d = HH(d, a, b, c, M_offset_4, 11, T[37]);
|
||||
c = HH(c, d, a, b, M_offset_7, 16, T[38]);
|
||||
b = HH(b, c, d, a, M_offset_10, 23, T[39]);
|
||||
a = HH(a, b, c, d, M_offset_13, 4, T[40]);
|
||||
d = HH(d, a, b, c, M_offset_0, 11, T[41]);
|
||||
c = HH(c, d, a, b, M_offset_3, 16, T[42]);
|
||||
b = HH(b, c, d, a, M_offset_6, 23, T[43]);
|
||||
a = HH(a, b, c, d, M_offset_9, 4, T[44]);
|
||||
d = HH(d, a, b, c, M_offset_12, 11, T[45]);
|
||||
c = HH(c, d, a, b, M_offset_15, 16, T[46]);
|
||||
b = HH(b, c, d, a, M_offset_2, 23, T[47]);
|
||||
|
||||
a = II(a, b, c, d, M_offset_0, 6, T[48]);
|
||||
d = II(d, a, b, c, M_offset_7, 10, T[49]);
|
||||
c = II(c, d, a, b, M_offset_14, 15, T[50]);
|
||||
b = II(b, c, d, a, M_offset_5, 21, T[51]);
|
||||
a = II(a, b, c, d, M_offset_12, 6, T[52]);
|
||||
d = II(d, a, b, c, M_offset_3, 10, T[53]);
|
||||
c = II(c, d, a, b, M_offset_10, 15, T[54]);
|
||||
b = II(b, c, d, a, M_offset_1, 21, T[55]);
|
||||
a = II(a, b, c, d, M_offset_8, 6, T[56]);
|
||||
d = II(d, a, b, c, M_offset_15, 10, T[57]);
|
||||
c = II(c, d, a, b, M_offset_6, 15, T[58]);
|
||||
b = II(b, c, d, a, M_offset_13, 21, T[59]);
|
||||
a = II(a, b, c, d, M_offset_4, 6, T[60]);
|
||||
d = II(d, a, b, c, M_offset_11, 10, T[61]);
|
||||
c = II(c, d, a, b, M_offset_2, 15, T[62]);
|
||||
b = II(b, c, d, a, M_offset_9, 21, T[63]);
|
||||
|
||||
// Intermediate hash value
|
||||
H[0] = (H[0] + a) | 0;
|
||||
H[1] = (H[1] + b) | 0;
|
||||
H[2] = (H[2] + c) | 0;
|
||||
H[3] = (H[3] + d) | 0;
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
|
||||
var nBitsTotal = this._nDataBytes * 8;
|
||||
var nBitsLeft = data.sigBytes * 8;
|
||||
|
||||
// Add padding
|
||||
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||
|
||||
var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
|
||||
var nBitsTotalL = nBitsTotal;
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
|
||||
(((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
|
||||
(((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
||||
(((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
|
||||
(((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
|
||||
data.sigBytes = (dataWords.length + 1) * 4;
|
||||
|
||||
// Hash final blocks
|
||||
this._process();
|
||||
|
||||
// Shortcuts
|
||||
var hash = this._hash;
|
||||
var H = hash.words;
|
||||
|
||||
// Swap endian
|
||||
for (var i = 0; i < 4; i++) {
|
||||
// Shortcut
|
||||
var H_i = H[i];
|
||||
|
||||
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
||||
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
||||
}
|
||||
|
||||
// Return final computed hash
|
||||
return hash;
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var clone = Hasher.clone.call(this);
|
||||
clone._hash = this._hash.clone();
|
||||
|
||||
return clone;
|
||||
}
|
||||
});
|
||||
|
||||
function FF(a, b, c, d, x, s, t) {
|
||||
var n = a + ((b & c) | (~b & d)) + x + t;
|
||||
return ((n << s) | (n >>> (32 - s))) + b;
|
||||
}
|
||||
|
||||
function GG(a, b, c, d, x, s, t) {
|
||||
var n = a + ((b & d) | (c & ~d)) + x + t;
|
||||
return ((n << s) | (n >>> (32 - s))) + b;
|
||||
}
|
||||
|
||||
function HH(a, b, c, d, x, s, t) {
|
||||
var n = a + (b ^ c ^ d) + x + t;
|
||||
return ((n << s) | (n >>> (32 - s))) + b;
|
||||
}
|
||||
|
||||
function II(a, b, c, d, x, s, t) {
|
||||
var n = a + (c ^ (b | ~d)) + x + t;
|
||||
return ((n << s) | (n >>> (32 - s))) + b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.MD5('message');
|
||||
* var hash = CryptoJS.MD5(wordArray);
|
||||
*/
|
||||
C.MD5 = Hasher._createHelper(MD5);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacMD5(message, key);
|
||||
*/
|
||||
C.HmacMD5 = Hasher._createHmacHelper(MD5);
|
||||
}(Math));
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var Hasher = C_lib.Hasher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Reusable object
|
||||
var W = [];
|
||||
|
||||
/**
|
||||
* SHA-1 hash algorithm.
|
||||
*/
|
||||
var SHA1 = C_algo.SHA1 = Hasher.extend({
|
||||
_doReset: function () {
|
||||
this._hash = new WordArray.init([
|
||||
0x67452301, 0xefcdab89,
|
||||
0x98badcfe, 0x10325476,
|
||||
0xc3d2e1f0
|
||||
]);
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Shortcut
|
||||
var H = this._hash.words;
|
||||
|
||||
// Working variables
|
||||
var a = H[0];
|
||||
var b = H[1];
|
||||
var c = H[2];
|
||||
var d = H[3];
|
||||
var e = H[4];
|
||||
|
||||
// Computation
|
||||
for (var i = 0; i < 80; i++) {
|
||||
if (i < 16) {
|
||||
W[i] = M[offset + i] | 0;
|
||||
} else {
|
||||
var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
|
||||
W[i] = (n << 1) | (n >>> 31);
|
||||
}
|
||||
|
||||
var t = ((a << 5) | (a >>> 27)) + e + W[i];
|
||||
if (i < 20) {
|
||||
t += ((b & c) | (~b & d)) + 0x5a827999;
|
||||
} else if (i < 40) {
|
||||
t += (b ^ c ^ d) + 0x6ed9eba1;
|
||||
} else if (i < 60) {
|
||||
t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
|
||||
} else /* if (i < 80) */ {
|
||||
t += (b ^ c ^ d) - 0x359d3e2a;
|
||||
}
|
||||
|
||||
e = d;
|
||||
d = c;
|
||||
c = (b << 30) | (b >>> 2);
|
||||
b = a;
|
||||
a = t;
|
||||
}
|
||||
|
||||
// Intermediate hash value
|
||||
H[0] = (H[0] + a) | 0;
|
||||
H[1] = (H[1] + b) | 0;
|
||||
H[2] = (H[2] + c) | 0;
|
||||
H[3] = (H[3] + d) | 0;
|
||||
H[4] = (H[4] + e) | 0;
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
|
||||
var nBitsTotal = this._nDataBytes * 8;
|
||||
var nBitsLeft = data.sigBytes * 8;
|
||||
|
||||
// Add padding
|
||||
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
|
||||
data.sigBytes = dataWords.length * 4;
|
||||
|
||||
// Hash final blocks
|
||||
this._process();
|
||||
|
||||
// Return final computed hash
|
||||
return this._hash;
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var clone = Hasher.clone.call(this);
|
||||
clone._hash = this._hash.clone();
|
||||
|
||||
return clone;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.SHA1('message');
|
||||
* var hash = CryptoJS.SHA1(wordArray);
|
||||
*/
|
||||
C.SHA1 = Hasher._createHelper(SHA1);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacSHA1(message, key);
|
||||
*/
|
||||
C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
|
||||
}());
|
||||
|
||||
|
||||
(function (Math) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var Hasher = C_lib.Hasher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Initialization and round constants tables
|
||||
var H = [];
|
||||
var K = [];
|
||||
|
||||
// Compute constants
|
||||
(function () {
|
||||
function isPrime(n) {
|
||||
var sqrtN = Math.sqrt(n);
|
||||
for (var factor = 2; factor <= sqrtN; factor++) {
|
||||
if (!(n % factor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getFractionalBits(n) {
|
||||
return ((n - (n | 0)) * 0x100000000) | 0;
|
||||
}
|
||||
|
||||
var n = 2;
|
||||
var nPrime = 0;
|
||||
while (nPrime < 64) {
|
||||
if (isPrime(n)) {
|
||||
if (nPrime < 8) {
|
||||
H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
|
||||
}
|
||||
K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
|
||||
|
||||
nPrime++;
|
||||
}
|
||||
|
||||
n++;
|
||||
}
|
||||
}());
|
||||
|
||||
// Reusable object
|
||||
var W = [];
|
||||
|
||||
/**
|
||||
* SHA-256 hash algorithm.
|
||||
*/
|
||||
var SHA256 = C_algo.SHA256 = Hasher.extend({
|
||||
_doReset: function () {
|
||||
this._hash = new WordArray.init(H.slice(0));
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Shortcut
|
||||
var H = this._hash.words;
|
||||
|
||||
// Working variables
|
||||
var a = H[0];
|
||||
var b = H[1];
|
||||
var c = H[2];
|
||||
var d = H[3];
|
||||
var e = H[4];
|
||||
var f = H[5];
|
||||
var g = H[6];
|
||||
var h = H[7];
|
||||
|
||||
// Computation
|
||||
for (var i = 0; i < 64; i++) {
|
||||
if (i < 16) {
|
||||
W[i] = M[offset + i] | 0;
|
||||
} else {
|
||||
var gamma0x = W[i - 15];
|
||||
var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
|
||||
((gamma0x << 14) | (gamma0x >>> 18)) ^
|
||||
(gamma0x >>> 3);
|
||||
|
||||
var gamma1x = W[i - 2];
|
||||
var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
|
||||
((gamma1x << 13) | (gamma1x >>> 19)) ^
|
||||
(gamma1x >>> 10);
|
||||
|
||||
W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
|
||||
}
|
||||
|
||||
var ch = (e & f) ^ (~e & g);
|
||||
var maj = (a & b) ^ (a & c) ^ (b & c);
|
||||
|
||||
var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
|
||||
var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
|
||||
|
||||
var t1 = h + sigma1 + ch + K[i] + W[i];
|
||||
var t2 = sigma0 + maj;
|
||||
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = (d + t1) | 0;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = (t1 + t2) | 0;
|
||||
}
|
||||
|
||||
// Intermediate hash value
|
||||
H[0] = (H[0] + a) | 0;
|
||||
H[1] = (H[1] + b) | 0;
|
||||
H[2] = (H[2] + c) | 0;
|
||||
H[3] = (H[3] + d) | 0;
|
||||
H[4] = (H[4] + e) | 0;
|
||||
H[5] = (H[5] + f) | 0;
|
||||
H[6] = (H[6] + g) | 0;
|
||||
H[7] = (H[7] + h) | 0;
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
|
||||
var nBitsTotal = this._nDataBytes * 8;
|
||||
var nBitsLeft = data.sigBytes * 8;
|
||||
|
||||
// Add padding
|
||||
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
|
||||
data.sigBytes = dataWords.length * 4;
|
||||
|
||||
// Hash final blocks
|
||||
this._process();
|
||||
|
||||
// Return final computed hash
|
||||
return this._hash;
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var clone = Hasher.clone.call(this);
|
||||
clone._hash = this._hash.clone();
|
||||
|
||||
return clone;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.SHA256('message');
|
||||
* var hash = CryptoJS.SHA256(wordArray);
|
||||
*/
|
||||
C.SHA256 = Hasher._createHelper(SHA256);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacSHA256(message, key);
|
||||
*/
|
||||
C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
|
||||
}(Math));
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var C_algo = C.algo;
|
||||
var SHA256 = C_algo.SHA256;
|
||||
|
||||
/**
|
||||
* SHA-224 hash algorithm.
|
||||
*/
|
||||
var SHA224 = C_algo.SHA224 = SHA256.extend({
|
||||
_doReset: function () {
|
||||
this._hash = new WordArray.init([
|
||||
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
|
||||
0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
|
||||
]);
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
var hash = SHA256._doFinalize.call(this);
|
||||
|
||||
hash.sigBytes -= 4;
|
||||
|
||||
return hash;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.SHA224('message');
|
||||
* var hash = CryptoJS.SHA224(wordArray);
|
||||
*/
|
||||
C.SHA224 = SHA256._createHelper(SHA224);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacSHA224(message, key);
|
||||
*/
|
||||
C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var Hasher = C_lib.Hasher;
|
||||
var C_x64 = C.x64;
|
||||
var X64Word = C_x64.Word;
|
||||
var X64WordArray = C_x64.WordArray;
|
||||
var C_algo = C.algo;
|
||||
|
||||
function X64Word_create() {
|
||||
return X64Word.create.apply(X64Word, arguments);
|
||||
}
|
||||
|
||||
// Constants
|
||||
var K = [
|
||||
X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
|
||||
X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
|
||||
X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
|
||||
X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
|
||||
X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
|
||||
X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
|
||||
X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
|
||||
X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
|
||||
X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
|
||||
X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
|
||||
X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
|
||||
X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
|
||||
X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
|
||||
X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
|
||||
X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
|
||||
X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
|
||||
X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
|
||||
X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
|
||||
X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
|
||||
X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
|
||||
X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
|
||||
X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
|
||||
X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
|
||||
X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
|
||||
X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
|
||||
X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
|
||||
X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
|
||||
X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
|
||||
X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
|
||||
X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
|
||||
X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
|
||||
X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
|
||||
X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
|
||||
X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
|
||||
X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
|
||||
X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
|
||||
X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
|
||||
X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
|
||||
X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
|
||||
X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
|
||||
];
|
||||
|
||||
// Reusable objects
|
||||
var W = [];
|
||||
(function () {
|
||||
for (var i = 0; i < 80; i++) {
|
||||
W[i] = X64Word_create();
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
* SHA-512 hash algorithm.
|
||||
*/
|
||||
var SHA512 = C_algo.SHA512 = Hasher.extend({
|
||||
_doReset: function () {
|
||||
this._hash = new X64WordArray.init([
|
||||
new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
|
||||
new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
|
||||
new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
|
||||
new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
|
||||
]);
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Shortcuts
|
||||
var H = this._hash.words;
|
||||
|
||||
var H0 = H[0];
|
||||
var H1 = H[1];
|
||||
var H2 = H[2];
|
||||
var H3 = H[3];
|
||||
var H4 = H[4];
|
||||
var H5 = H[5];
|
||||
var H6 = H[6];
|
||||
var H7 = H[7];
|
||||
|
||||
var H0h = H0.high;
|
||||
var H0l = H0.low;
|
||||
var H1h = H1.high;
|
||||
var H1l = H1.low;
|
||||
var H2h = H2.high;
|
||||
var H2l = H2.low;
|
||||
var H3h = H3.high;
|
||||
var H3l = H3.low;
|
||||
var H4h = H4.high;
|
||||
var H4l = H4.low;
|
||||
var H5h = H5.high;
|
||||
var H5l = H5.low;
|
||||
var H6h = H6.high;
|
||||
var H6l = H6.low;
|
||||
var H7h = H7.high;
|
||||
var H7l = H7.low;
|
||||
|
||||
// Working variables
|
||||
var ah = H0h;
|
||||
var al = H0l;
|
||||
var bh = H1h;
|
||||
var bl = H1l;
|
||||
var ch = H2h;
|
||||
var cl = H2l;
|
||||
var dh = H3h;
|
||||
var dl = H3l;
|
||||
var eh = H4h;
|
||||
var el = H4l;
|
||||
var fh = H5h;
|
||||
var fl = H5l;
|
||||
var gh = H6h;
|
||||
var gl = H6l;
|
||||
var hh = H7h;
|
||||
var hl = H7l;
|
||||
|
||||
// Rounds
|
||||
for (var i = 0; i < 80; i++) {
|
||||
var Wil;
|
||||
var Wih;
|
||||
|
||||
// Shortcut
|
||||
var Wi = W[i];
|
||||
|
||||
// Extend message
|
||||
if (i < 16) {
|
||||
Wih = Wi.high = M[offset + i * 2] | 0;
|
||||
Wil = Wi.low = M[offset + i * 2 + 1] | 0;
|
||||
} else {
|
||||
// Gamma0
|
||||
var gamma0x = W[i - 15];
|
||||
var gamma0xh = gamma0x.high;
|
||||
var gamma0xl = gamma0x.low;
|
||||
var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
|
||||
var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
|
||||
|
||||
// Gamma1
|
||||
var gamma1x = W[i - 2];
|
||||
var gamma1xh = gamma1x.high;
|
||||
var gamma1xl = gamma1x.low;
|
||||
var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
|
||||
var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
|
||||
|
||||
// W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
|
||||
var Wi7 = W[i - 7];
|
||||
var Wi7h = Wi7.high;
|
||||
var Wi7l = Wi7.low;
|
||||
|
||||
var Wi16 = W[i - 16];
|
||||
var Wi16h = Wi16.high;
|
||||
var Wi16l = Wi16.low;
|
||||
|
||||
Wil = gamma0l + Wi7l;
|
||||
Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
|
||||
Wil = Wil + gamma1l;
|
||||
Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
|
||||
Wil = Wil + Wi16l;
|
||||
Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
|
||||
|
||||
Wi.high = Wih;
|
||||
Wi.low = Wil;
|
||||
}
|
||||
|
||||
var chh = (eh & fh) ^ (~eh & gh);
|
||||
var chl = (el & fl) ^ (~el & gl);
|
||||
var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
|
||||
var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
|
||||
|
||||
var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
|
||||
var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
|
||||
var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
|
||||
var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
|
||||
|
||||
// t1 = h + sigma1 + ch + K[i] + W[i]
|
||||
var Ki = K[i];
|
||||
var Kih = Ki.high;
|
||||
var Kil = Ki.low;
|
||||
|
||||
var t1l = hl + sigma1l;
|
||||
var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
|
||||
var t1l = t1l + chl;
|
||||
var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
|
||||
var t1l = t1l + Kil;
|
||||
var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
|
||||
var t1l = t1l + Wil;
|
||||
var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
|
||||
|
||||
// t2 = sigma0 + maj
|
||||
var t2l = sigma0l + majl;
|
||||
var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
|
||||
|
||||
// Update working variables
|
||||
hh = gh;
|
||||
hl = gl;
|
||||
gh = fh;
|
||||
gl = fl;
|
||||
fh = eh;
|
||||
fl = el;
|
||||
el = (dl + t1l) | 0;
|
||||
eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
|
||||
dh = ch;
|
||||
dl = cl;
|
||||
ch = bh;
|
||||
cl = bl;
|
||||
bh = ah;
|
||||
bl = al;
|
||||
al = (t1l + t2l) | 0;
|
||||
ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
|
||||
}
|
||||
|
||||
// Intermediate hash value
|
||||
H0l = H0.low = (H0l + al);
|
||||
H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
|
||||
H1l = H1.low = (H1l + bl);
|
||||
H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
|
||||
H2l = H2.low = (H2l + cl);
|
||||
H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
|
||||
H3l = H3.low = (H3l + dl);
|
||||
H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
|
||||
H4l = H4.low = (H4l + el);
|
||||
H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
|
||||
H5l = H5.low = (H5l + fl);
|
||||
H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
|
||||
H6l = H6.low = (H6l + gl);
|
||||
H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
|
||||
H7l = H7.low = (H7l + hl);
|
||||
H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
|
||||
var nBitsTotal = this._nDataBytes * 8;
|
||||
var nBitsLeft = data.sigBytes * 8;
|
||||
|
||||
// Add padding
|
||||
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||
dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
|
||||
dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
|
||||
data.sigBytes = dataWords.length * 4;
|
||||
|
||||
// Hash final blocks
|
||||
this._process();
|
||||
|
||||
// Convert hash to 32-bit word array before returning
|
||||
var hash = this._hash.toX32();
|
||||
|
||||
// Return final computed hash
|
||||
return hash;
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var clone = Hasher.clone.call(this);
|
||||
clone._hash = this._hash.clone();
|
||||
|
||||
return clone;
|
||||
},
|
||||
|
||||
blockSize: 1024/32
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.SHA512('message');
|
||||
* var hash = CryptoJS.SHA512(wordArray);
|
||||
*/
|
||||
C.SHA512 = Hasher._createHelper(SHA512);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacSHA512(message, key);
|
||||
*/
|
||||
C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_x64 = C.x64;
|
||||
var X64Word = C_x64.Word;
|
||||
var X64WordArray = C_x64.WordArray;
|
||||
var C_algo = C.algo;
|
||||
var SHA512 = C_algo.SHA512;
|
||||
|
||||
/**
|
||||
* SHA-384 hash algorithm.
|
||||
*/
|
||||
var SHA384 = C_algo.SHA384 = SHA512.extend({
|
||||
_doReset: function () {
|
||||
this._hash = new X64WordArray.init([
|
||||
new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
|
||||
new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
|
||||
new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
|
||||
new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
|
||||
]);
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
var hash = SHA512._doFinalize.call(this);
|
||||
|
||||
hash.sigBytes -= 16;
|
||||
|
||||
return hash;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.SHA384('message');
|
||||
* var hash = CryptoJS.SHA384(wordArray);
|
||||
*/
|
||||
C.SHA384 = SHA512._createHelper(SHA384);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacSHA384(message, key);
|
||||
*/
|
||||
C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
|
||||
}());
|
||||
|
||||
|
||||
(function (Math) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var Hasher = C_lib.Hasher;
|
||||
var C_x64 = C.x64;
|
||||
var X64Word = C_x64.Word;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Constants tables
|
||||
var RHO_OFFSETS = [];
|
||||
var PI_INDEXES = [];
|
||||
var ROUND_CONSTANTS = [];
|
||||
|
||||
// Compute Constants
|
||||
(function () {
|
||||
// Compute rho offset constants
|
||||
var x = 1, y = 0;
|
||||
for (var t = 0; t < 24; t++) {
|
||||
RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
|
||||
|
||||
var newX = y % 5;
|
||||
var newY = (2 * x + 3 * y) % 5;
|
||||
x = newX;
|
||||
y = newY;
|
||||
}
|
||||
|
||||
// Compute pi index constants
|
||||
for (var x = 0; x < 5; x++) {
|
||||
for (var y = 0; y < 5; y++) {
|
||||
PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute round constants
|
||||
var LFSR = 0x01;
|
||||
for (var i = 0; i < 24; i++) {
|
||||
var roundConstantMsw = 0;
|
||||
var roundConstantLsw = 0;
|
||||
|
||||
for (var j = 0; j < 7; j++) {
|
||||
if (LFSR & 0x01) {
|
||||
var bitPosition = (1 << j) - 1;
|
||||
if (bitPosition < 32) {
|
||||
roundConstantLsw ^= 1 << bitPosition;
|
||||
} else /* if (bitPosition >= 32) */ {
|
||||
roundConstantMsw ^= 1 << (bitPosition - 32);
|
||||
}
|
||||
}
|
||||
|
||||
// Compute next LFSR
|
||||
if (LFSR & 0x80) {
|
||||
// Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
|
||||
LFSR = (LFSR << 1) ^ 0x71;
|
||||
} else {
|
||||
LFSR <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
|
||||
}
|
||||
}());
|
||||
|
||||
// Reusable objects for temporary values
|
||||
var T = [];
|
||||
(function () {
|
||||
for (var i = 0; i < 25; i++) {
|
||||
T[i] = X64Word.create();
|
||||
}
|
||||
}());
|
||||
|
||||
/**
|
||||
* SHA-3 hash algorithm.
|
||||
*/
|
||||
var SHA3 = C_algo.SHA3 = Hasher.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {number} outputLength
|
||||
* The desired number of bits in the output hash.
|
||||
* Only values permitted are: 224, 256, 384, 512.
|
||||
* Default: 512
|
||||
*/
|
||||
cfg: Hasher.cfg.extend({
|
||||
outputLength: 512
|
||||
}),
|
||||
|
||||
_doReset: function () {
|
||||
var state = this._state = []
|
||||
for (var i = 0; i < 25; i++) {
|
||||
state[i] = new X64Word.init();
|
||||
}
|
||||
|
||||
this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Shortcuts
|
||||
var state = this._state;
|
||||
var nBlockSizeLanes = this.blockSize / 2;
|
||||
|
||||
// Absorb
|
||||
for (var i = 0; i < nBlockSizeLanes; i++) {
|
||||
// Shortcuts
|
||||
var M2i = M[offset + 2 * i];
|
||||
var M2i1 = M[offset + 2 * i + 1];
|
||||
|
||||
// Swap endian
|
||||
M2i = (
|
||||
(((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
|
||||
(((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
M2i1 = (
|
||||
(((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
|
||||
(((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
|
||||
// Absorb message into state
|
||||
var lane = state[i];
|
||||
lane.high ^= M2i1;
|
||||
lane.low ^= M2i;
|
||||
}
|
||||
|
||||
// Rounds
|
||||
for (var round = 0; round < 24; round++) {
|
||||
// Theta
|
||||
for (var x = 0; x < 5; x++) {
|
||||
// Mix column lanes
|
||||
var tMsw = 0, tLsw = 0;
|
||||
for (var y = 0; y < 5; y++) {
|
||||
var lane = state[x + 5 * y];
|
||||
tMsw ^= lane.high;
|
||||
tLsw ^= lane.low;
|
||||
}
|
||||
|
||||
// Temporary values
|
||||
var Tx = T[x];
|
||||
Tx.high = tMsw;
|
||||
Tx.low = tLsw;
|
||||
}
|
||||
for (var x = 0; x < 5; x++) {
|
||||
// Shortcuts
|
||||
var Tx4 = T[(x + 4) % 5];
|
||||
var Tx1 = T[(x + 1) % 5];
|
||||
var Tx1Msw = Tx1.high;
|
||||
var Tx1Lsw = Tx1.low;
|
||||
|
||||
// Mix surrounding columns
|
||||
var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
|
||||
var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
|
||||
for (var y = 0; y < 5; y++) {
|
||||
var lane = state[x + 5 * y];
|
||||
lane.high ^= tMsw;
|
||||
lane.low ^= tLsw;
|
||||
}
|
||||
}
|
||||
|
||||
// Rho Pi
|
||||
for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
|
||||
var tMsw;
|
||||
var tLsw;
|
||||
|
||||
// Shortcuts
|
||||
var lane = state[laneIndex];
|
||||
var laneMsw = lane.high;
|
||||
var laneLsw = lane.low;
|
||||
var rhoOffset = RHO_OFFSETS[laneIndex];
|
||||
|
||||
// Rotate lanes
|
||||
if (rhoOffset < 32) {
|
||||
tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
|
||||
tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
|
||||
} else /* if (rhoOffset >= 32) */ {
|
||||
tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
|
||||
tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
|
||||
}
|
||||
|
||||
// Transpose lanes
|
||||
var TPiLane = T[PI_INDEXES[laneIndex]];
|
||||
TPiLane.high = tMsw;
|
||||
TPiLane.low = tLsw;
|
||||
}
|
||||
|
||||
// Rho pi at x = y = 0
|
||||
var T0 = T[0];
|
||||
var state0 = state[0];
|
||||
T0.high = state0.high;
|
||||
T0.low = state0.low;
|
||||
|
||||
// Chi
|
||||
for (var x = 0; x < 5; x++) {
|
||||
for (var y = 0; y < 5; y++) {
|
||||
// Shortcuts
|
||||
var laneIndex = x + 5 * y;
|
||||
var lane = state[laneIndex];
|
||||
var TLane = T[laneIndex];
|
||||
var Tx1Lane = T[((x + 1) % 5) + 5 * y];
|
||||
var Tx2Lane = T[((x + 2) % 5) + 5 * y];
|
||||
|
||||
// Mix rows
|
||||
lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
|
||||
lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
|
||||
}
|
||||
}
|
||||
|
||||
// Iota
|
||||
var lane = state[0];
|
||||
var roundConstant = ROUND_CONSTANTS[round];
|
||||
lane.high ^= roundConstant.high;
|
||||
lane.low ^= roundConstant.low;
|
||||
}
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
var nBitsTotal = this._nDataBytes * 8;
|
||||
var nBitsLeft = data.sigBytes * 8;
|
||||
var blockSizeBits = this.blockSize * 32;
|
||||
|
||||
// Add padding
|
||||
dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
|
||||
dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
|
||||
data.sigBytes = dataWords.length * 4;
|
||||
|
||||
// Hash final blocks
|
||||
this._process();
|
||||
|
||||
// Shortcuts
|
||||
var state = this._state;
|
||||
var outputLengthBytes = this.cfg.outputLength / 8;
|
||||
var outputLengthLanes = outputLengthBytes / 8;
|
||||
|
||||
// Squeeze
|
||||
var hashWords = [];
|
||||
for (var i = 0; i < outputLengthLanes; i++) {
|
||||
// Shortcuts
|
||||
var lane = state[i];
|
||||
var laneMsw = lane.high;
|
||||
var laneLsw = lane.low;
|
||||
|
||||
// Swap endian
|
||||
laneMsw = (
|
||||
(((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
|
||||
(((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
laneLsw = (
|
||||
(((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
|
||||
(((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
|
||||
// Squeeze state to retrieve hash
|
||||
hashWords.push(laneLsw);
|
||||
hashWords.push(laneMsw);
|
||||
}
|
||||
|
||||
// Return final computed hash
|
||||
return new WordArray.init(hashWords, outputLengthBytes);
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var clone = Hasher.clone.call(this);
|
||||
|
||||
var state = clone._state = this._state.slice(0);
|
||||
for (var i = 0; i < 25; i++) {
|
||||
state[i] = state[i].clone();
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.SHA3('message');
|
||||
* var hash = CryptoJS.SHA3(wordArray);
|
||||
*/
|
||||
C.SHA3 = Hasher._createHelper(SHA3);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacSHA3(message, key);
|
||||
*/
|
||||
C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
|
||||
}(Math));
|
||||
|
||||
|
||||
/** @preserve
|
||||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
(function (Math) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var Hasher = C_lib.Hasher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Constants table
|
||||
var _zl = WordArray.create([
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
|
||||
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
|
||||
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
|
||||
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
|
||||
var _zr = WordArray.create([
|
||||
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
|
||||
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
|
||||
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
|
||||
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
|
||||
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
|
||||
var _sl = WordArray.create([
|
||||
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
|
||||
7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
|
||||
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
|
||||
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
|
||||
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
|
||||
var _sr = WordArray.create([
|
||||
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
|
||||
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
|
||||
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
|
||||
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
|
||||
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
|
||||
|
||||
var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
|
||||
var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
|
||||
|
||||
/**
|
||||
* RIPEMD160 hash algorithm.
|
||||
*/
|
||||
var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
|
||||
_doReset: function () {
|
||||
this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
|
||||
// Swap endian
|
||||
for (var i = 0; i < 16; i++) {
|
||||
// Shortcuts
|
||||
var offset_i = offset + i;
|
||||
var M_offset_i = M[offset_i];
|
||||
|
||||
// Swap
|
||||
M[offset_i] = (
|
||||
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
||||
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
}
|
||||
// Shortcut
|
||||
var H = this._hash.words;
|
||||
var hl = _hl.words;
|
||||
var hr = _hr.words;
|
||||
var zl = _zl.words;
|
||||
var zr = _zr.words;
|
||||
var sl = _sl.words;
|
||||
var sr = _sr.words;
|
||||
|
||||
// Working variables
|
||||
var al, bl, cl, dl, el;
|
||||
var ar, br, cr, dr, er;
|
||||
|
||||
ar = al = H[0];
|
||||
br = bl = H[1];
|
||||
cr = cl = H[2];
|
||||
dr = dl = H[3];
|
||||
er = el = H[4];
|
||||
// Computation
|
||||
var t;
|
||||
for (var i = 0; i < 80; i += 1) {
|
||||
t = (al + M[offset+zl[i]])|0;
|
||||
if (i<16){
|
||||
t += f1(bl,cl,dl) + hl[0];
|
||||
} else if (i<32) {
|
||||
t += f2(bl,cl,dl) + hl[1];
|
||||
} else if (i<48) {
|
||||
t += f3(bl,cl,dl) + hl[2];
|
||||
} else if (i<64) {
|
||||
t += f4(bl,cl,dl) + hl[3];
|
||||
} else {// if (i<80) {
|
||||
t += f5(bl,cl,dl) + hl[4];
|
||||
}
|
||||
t = t|0;
|
||||
t = rotl(t,sl[i]);
|
||||
t = (t+el)|0;
|
||||
al = el;
|
||||
el = dl;
|
||||
dl = rotl(cl, 10);
|
||||
cl = bl;
|
||||
bl = t;
|
||||
|
||||
t = (ar + M[offset+zr[i]])|0;
|
||||
if (i<16){
|
||||
t += f5(br,cr,dr) + hr[0];
|
||||
} else if (i<32) {
|
||||
t += f4(br,cr,dr) + hr[1];
|
||||
} else if (i<48) {
|
||||
t += f3(br,cr,dr) + hr[2];
|
||||
} else if (i<64) {
|
||||
t += f2(br,cr,dr) + hr[3];
|
||||
} else {// if (i<80) {
|
||||
t += f1(br,cr,dr) + hr[4];
|
||||
}
|
||||
t = t|0;
|
||||
t = rotl(t,sr[i]) ;
|
||||
t = (t+er)|0;
|
||||
ar = er;
|
||||
er = dr;
|
||||
dr = rotl(cr, 10);
|
||||
cr = br;
|
||||
br = t;
|
||||
}
|
||||
// Intermediate hash value
|
||||
t = (H[1] + cl + dr)|0;
|
||||
H[1] = (H[2] + dl + er)|0;
|
||||
H[2] = (H[3] + el + ar)|0;
|
||||
H[3] = (H[4] + al + br)|0;
|
||||
H[4] = (H[0] + bl + cr)|0;
|
||||
H[0] = t;
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
// Shortcuts
|
||||
var data = this._data;
|
||||
var dataWords = data.words;
|
||||
|
||||
var nBitsTotal = this._nDataBytes * 8;
|
||||
var nBitsLeft = data.sigBytes * 8;
|
||||
|
||||
// Add padding
|
||||
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
||||
(((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
|
||||
(((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
|
||||
);
|
||||
data.sigBytes = (dataWords.length + 1) * 4;
|
||||
|
||||
// Hash final blocks
|
||||
this._process();
|
||||
|
||||
// Shortcuts
|
||||
var hash = this._hash;
|
||||
var H = hash.words;
|
||||
|
||||
// Swap endian
|
||||
for (var i = 0; i < 5; i++) {
|
||||
// Shortcut
|
||||
var H_i = H[i];
|
||||
|
||||
// Swap
|
||||
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
||||
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
||||
}
|
||||
|
||||
// Return final computed hash
|
||||
return hash;
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var clone = Hasher.clone.call(this);
|
||||
clone._hash = this._hash.clone();
|
||||
|
||||
return clone;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function f1(x, y, z) {
|
||||
return ((x) ^ (y) ^ (z));
|
||||
|
||||
}
|
||||
|
||||
function f2(x, y, z) {
|
||||
return (((x)&(y)) | ((~x)&(z)));
|
||||
}
|
||||
|
||||
function f3(x, y, z) {
|
||||
return (((x) | (~(y))) ^ (z));
|
||||
}
|
||||
|
||||
function f4(x, y, z) {
|
||||
return (((x) & (z)) | ((y)&(~(z))));
|
||||
}
|
||||
|
||||
function f5(x, y, z) {
|
||||
return ((x) ^ ((y) |(~(z))));
|
||||
|
||||
}
|
||||
|
||||
function rotl(x,n) {
|
||||
return (x<<n) | (x>>>(32-n));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shortcut function to the hasher's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
*
|
||||
* @return {WordArray} The hash.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hash = CryptoJS.RIPEMD160('message');
|
||||
* var hash = CryptoJS.RIPEMD160(wordArray);
|
||||
*/
|
||||
C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
|
||||
|
||||
/**
|
||||
* Shortcut function to the HMAC's object interface.
|
||||
*
|
||||
* @param {WordArray|string} message The message to hash.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = CryptoJS.HmacRIPEMD160(message, key);
|
||||
*/
|
||||
C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
|
||||
}(Math));
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var Base = C_lib.Base;
|
||||
var C_enc = C.enc;
|
||||
var Utf8 = C_enc.Utf8;
|
||||
var C_algo = C.algo;
|
||||
|
||||
/**
|
||||
* HMAC algorithm.
|
||||
*/
|
||||
var HMAC = C_algo.HMAC = Base.extend({
|
||||
/**
|
||||
* Initializes a newly created HMAC.
|
||||
*
|
||||
* @param {Hasher} hasher The hash algorithm to use.
|
||||
* @param {WordArray|string} key The secret key.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
|
||||
*/
|
||||
init: function (hasher, key) {
|
||||
// Init hasher
|
||||
hasher = this._hasher = new hasher.init();
|
||||
|
||||
// Convert string to WordArray, else assume WordArray already
|
||||
if (typeof key == 'string') {
|
||||
key = Utf8.parse(key);
|
||||
}
|
||||
|
||||
// Shortcuts
|
||||
var hasherBlockSize = hasher.blockSize;
|
||||
var hasherBlockSizeBytes = hasherBlockSize * 4;
|
||||
|
||||
// Allow arbitrary length keys
|
||||
if (key.sigBytes > hasherBlockSizeBytes) {
|
||||
key = hasher.finalize(key);
|
||||
}
|
||||
|
||||
// Clamp excess bits
|
||||
key.clamp();
|
||||
|
||||
// Clone key for inner and outer pads
|
||||
var oKey = this._oKey = key.clone();
|
||||
var iKey = this._iKey = key.clone();
|
||||
|
||||
// Shortcuts
|
||||
var oKeyWords = oKey.words;
|
||||
var iKeyWords = iKey.words;
|
||||
|
||||
// XOR keys with pad constants
|
||||
for (var i = 0; i < hasherBlockSize; i++) {
|
||||
oKeyWords[i] ^= 0x5c5c5c5c;
|
||||
iKeyWords[i] ^= 0x36363636;
|
||||
}
|
||||
oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
|
||||
|
||||
// Set initial values
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets this HMAC to its initial state.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* hmacHasher.reset();
|
||||
*/
|
||||
reset: function () {
|
||||
// Shortcut
|
||||
var hasher = this._hasher;
|
||||
|
||||
// Reset
|
||||
hasher.reset();
|
||||
hasher.update(this._iKey);
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates this HMAC with a message.
|
||||
*
|
||||
* @param {WordArray|string} messageUpdate The message to append.
|
||||
*
|
||||
* @return {HMAC} This HMAC instance.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* hmacHasher.update('message');
|
||||
* hmacHasher.update(wordArray);
|
||||
*/
|
||||
update: function (messageUpdate) {
|
||||
this._hasher.update(messageUpdate);
|
||||
|
||||
// Chainable
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Finalizes the HMAC computation.
|
||||
* Note that the finalize operation is effectively a destructive, read-once operation.
|
||||
*
|
||||
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
||||
*
|
||||
* @return {WordArray} The HMAC.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hmac = hmacHasher.finalize();
|
||||
* var hmac = hmacHasher.finalize('message');
|
||||
* var hmac = hmacHasher.finalize(wordArray);
|
||||
*/
|
||||
finalize: function (messageUpdate) {
|
||||
// Shortcut
|
||||
var hasher = this._hasher;
|
||||
|
||||
// Compute HMAC
|
||||
var innerHash = hasher.finalize(messageUpdate);
|
||||
hasher.reset();
|
||||
var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
|
||||
|
||||
return hmac;
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var Base = C_lib.Base;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var C_algo = C.algo;
|
||||
var SHA1 = C_algo.SHA1;
|
||||
var HMAC = C_algo.HMAC;
|
||||
|
||||
/**
|
||||
* Password-Based Key Derivation Function 2 algorithm.
|
||||
*/
|
||||
var PBKDF2 = C_algo.PBKDF2 = Base.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
|
||||
* @property {Hasher} hasher The hasher to use. Default: SHA1
|
||||
* @property {number} iterations The number of iterations to perform. Default: 1
|
||||
*/
|
||||
cfg: Base.extend({
|
||||
keySize: 128/32,
|
||||
hasher: SHA1,
|
||||
iterations: 1
|
||||
}),
|
||||
|
||||
/**
|
||||
* Initializes a newly created key derivation function.
|
||||
*
|
||||
* @param {Object} cfg (Optional) The configuration options to use for the derivation.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var kdf = CryptoJS.algo.PBKDF2.create();
|
||||
* var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
|
||||
* var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
|
||||
*/
|
||||
init: function (cfg) {
|
||||
this.cfg = this.cfg.extend(cfg);
|
||||
},
|
||||
|
||||
/**
|
||||
* Computes the Password-Based Key Derivation Function 2.
|
||||
*
|
||||
* @param {WordArray|string} password The password.
|
||||
* @param {WordArray|string} salt A salt.
|
||||
*
|
||||
* @return {WordArray} The derived key.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var key = kdf.compute(password, salt);
|
||||
*/
|
||||
compute: function (password, salt) {
|
||||
// Shortcut
|
||||
var cfg = this.cfg;
|
||||
|
||||
// Init HMAC
|
||||
var hmac = HMAC.create(cfg.hasher, password);
|
||||
|
||||
// Initial values
|
||||
var derivedKey = WordArray.create();
|
||||
var blockIndex = WordArray.create([0x00000001]);
|
||||
|
||||
// Shortcuts
|
||||
var derivedKeyWords = derivedKey.words;
|
||||
var blockIndexWords = blockIndex.words;
|
||||
var keySize = cfg.keySize;
|
||||
var iterations = cfg.iterations;
|
||||
|
||||
// Generate key
|
||||
while (derivedKeyWords.length < keySize) {
|
||||
var block = hmac.update(salt).finalize(blockIndex);
|
||||
hmac.reset();
|
||||
|
||||
// Shortcuts
|
||||
var blockWords = block.words;
|
||||
var blockWordsLength = blockWords.length;
|
||||
|
||||
// Iterations
|
||||
var intermediate = block;
|
||||
for (var i = 1; i < iterations; i++) {
|
||||
intermediate = hmac.finalize(intermediate);
|
||||
hmac.reset();
|
||||
|
||||
// Shortcut
|
||||
var intermediateWords = intermediate.words;
|
||||
|
||||
// XOR intermediate with block
|
||||
for (var j = 0; j < blockWordsLength; j++) {
|
||||
blockWords[j] ^= intermediateWords[j];
|
||||
}
|
||||
}
|
||||
|
||||
derivedKey.concat(block);
|
||||
blockIndexWords[0]++;
|
||||
}
|
||||
derivedKey.sigBytes = keySize * 4;
|
||||
|
||||
return derivedKey;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Computes the Password-Based Key Derivation Function 2.
|
||||
*
|
||||
* @param {WordArray|string} password The password.
|
||||
* @param {WordArray|string} salt A salt.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this computation.
|
||||
*
|
||||
* @return {WordArray} The derived key.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var key = CryptoJS.PBKDF2(password, salt);
|
||||
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
|
||||
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
|
||||
*/
|
||||
C.PBKDF2 = function (password, salt, cfg) {
|
||||
return PBKDF2.create(cfg).compute(password, salt);
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var Base = C_lib.Base;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var C_algo = C.algo;
|
||||
var MD5 = C_algo.MD5;
|
||||
|
||||
/**
|
||||
* This key derivation function is meant to conform with EVP_BytesToKey.
|
||||
* www.openssl.org/docs/crypto/EVP_BytesToKey.html
|
||||
*/
|
||||
var EvpKDF = C_algo.EvpKDF = Base.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
|
||||
* @property {Hasher} hasher The hash algorithm to use. Default: MD5
|
||||
* @property {number} iterations The number of iterations to perform. Default: 1
|
||||
*/
|
||||
cfg: Base.extend({
|
||||
keySize: 128/32,
|
||||
hasher: MD5,
|
||||
iterations: 1
|
||||
}),
|
||||
|
||||
/**
|
||||
* Initializes a newly created key derivation function.
|
||||
*
|
||||
* @param {Object} cfg (Optional) The configuration options to use for the derivation.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var kdf = CryptoJS.algo.EvpKDF.create();
|
||||
* var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
|
||||
* var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
|
||||
*/
|
||||
init: function (cfg) {
|
||||
this.cfg = this.cfg.extend(cfg);
|
||||
},
|
||||
|
||||
/**
|
||||
* Derives a key from a password.
|
||||
*
|
||||
* @param {WordArray|string} password The password.
|
||||
* @param {WordArray|string} salt A salt.
|
||||
*
|
||||
* @return {WordArray} The derived key.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var key = kdf.compute(password, salt);
|
||||
*/
|
||||
compute: function (password, salt) {
|
||||
var block;
|
||||
|
||||
// Shortcut
|
||||
var cfg = this.cfg;
|
||||
|
||||
// Init hasher
|
||||
var hasher = cfg.hasher.create();
|
||||
|
||||
// Initial values
|
||||
var derivedKey = WordArray.create();
|
||||
|
||||
// Shortcuts
|
||||
var derivedKeyWords = derivedKey.words;
|
||||
var keySize = cfg.keySize;
|
||||
var iterations = cfg.iterations;
|
||||
|
||||
// Generate key
|
||||
while (derivedKeyWords.length < keySize) {
|
||||
if (block) {
|
||||
hasher.update(block);
|
||||
}
|
||||
block = hasher.update(password).finalize(salt);
|
||||
hasher.reset();
|
||||
|
||||
// Iterations
|
||||
for (var i = 1; i < iterations; i++) {
|
||||
block = hasher.finalize(block);
|
||||
hasher.reset();
|
||||
}
|
||||
|
||||
derivedKey.concat(block);
|
||||
}
|
||||
derivedKey.sigBytes = keySize * 4;
|
||||
|
||||
return derivedKey;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Derives a key from a password.
|
||||
*
|
||||
* @param {WordArray|string} password The password.
|
||||
* @param {WordArray|string} salt A salt.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this computation.
|
||||
*
|
||||
* @return {WordArray} The derived key.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var key = CryptoJS.EvpKDF(password, salt);
|
||||
* var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
|
||||
* var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
|
||||
*/
|
||||
C.EvpKDF = function (password, salt, cfg) {
|
||||
return EvpKDF.create(cfg).compute(password, salt);
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* Cipher core components.
|
||||
*/
|
||||
CryptoJS.lib.Cipher || (function (undefined) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var Base = C_lib.Base;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
||||
var C_enc = C.enc;
|
||||
var Utf8 = C_enc.Utf8;
|
||||
var Base64 = C_enc.Base64;
|
||||
var C_algo = C.algo;
|
||||
var EvpKDF = C_algo.EvpKDF;
|
||||
|
||||
/**
|
||||
* Abstract base cipher template.
|
||||
*
|
||||
* @property {number} keySize This cipher's key size. Default: 4 (128 bits)
|
||||
* @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
|
||||
* @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
|
||||
* @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
|
||||
*/
|
||||
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {WordArray} iv The IV to use for this operation.
|
||||
*/
|
||||
cfg: Base.extend(),
|
||||
|
||||
/**
|
||||
* Creates this cipher in encryption mode.
|
||||
*
|
||||
* @param {WordArray} key The key.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @return {Cipher} A cipher instance.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
|
||||
*/
|
||||
createEncryptor: function (key, cfg) {
|
||||
return this.create(this._ENC_XFORM_MODE, key, cfg);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates this cipher in decryption mode.
|
||||
*
|
||||
* @param {WordArray} key The key.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @return {Cipher} A cipher instance.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
|
||||
*/
|
||||
createDecryptor: function (key, cfg) {
|
||||
return this.create(this._DEC_XFORM_MODE, key, cfg);
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes a newly created cipher.
|
||||
*
|
||||
* @param {number} xformMode Either the encryption or decryption transormation mode constant.
|
||||
* @param {WordArray} key The key.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
|
||||
*/
|
||||
init: function (xformMode, key, cfg) {
|
||||
// Apply config defaults
|
||||
this.cfg = this.cfg.extend(cfg);
|
||||
|
||||
// Store transform mode and key
|
||||
this._xformMode = xformMode;
|
||||
this._key = key;
|
||||
|
||||
// Set initial values
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets this cipher to its initial state.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* cipher.reset();
|
||||
*/
|
||||
reset: function () {
|
||||
// Reset data buffer
|
||||
BufferedBlockAlgorithm.reset.call(this);
|
||||
|
||||
// Perform concrete-cipher logic
|
||||
this._doReset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds data to be encrypted or decrypted.
|
||||
*
|
||||
* @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
|
||||
*
|
||||
* @return {WordArray} The data after processing.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var encrypted = cipher.process('data');
|
||||
* var encrypted = cipher.process(wordArray);
|
||||
*/
|
||||
process: function (dataUpdate) {
|
||||
// Append
|
||||
this._append(dataUpdate);
|
||||
|
||||
// Process available blocks
|
||||
return this._process();
|
||||
},
|
||||
|
||||
/**
|
||||
* Finalizes the encryption or decryption process.
|
||||
* Note that the finalize operation is effectively a destructive, read-once operation.
|
||||
*
|
||||
* @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
|
||||
*
|
||||
* @return {WordArray} The data after final processing.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var encrypted = cipher.finalize();
|
||||
* var encrypted = cipher.finalize('data');
|
||||
* var encrypted = cipher.finalize(wordArray);
|
||||
*/
|
||||
finalize: function (dataUpdate) {
|
||||
// Final data update
|
||||
if (dataUpdate) {
|
||||
this._append(dataUpdate);
|
||||
}
|
||||
|
||||
// Perform concrete-cipher logic
|
||||
var finalProcessedData = this._doFinalize();
|
||||
|
||||
return finalProcessedData;
|
||||
},
|
||||
|
||||
keySize: 128/32,
|
||||
|
||||
ivSize: 128/32,
|
||||
|
||||
_ENC_XFORM_MODE: 1,
|
||||
|
||||
_DEC_XFORM_MODE: 2,
|
||||
|
||||
/**
|
||||
* Creates shortcut functions to a cipher's object interface.
|
||||
*
|
||||
* @param {Cipher} cipher The cipher to create a helper for.
|
||||
*
|
||||
* @return {Object} An object with encrypt and decrypt shortcut functions.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
|
||||
*/
|
||||
_createHelper: (function () {
|
||||
function selectCipherStrategy(key) {
|
||||
if (typeof key == 'string') {
|
||||
return PasswordBasedCipher;
|
||||
} else {
|
||||
return SerializableCipher;
|
||||
}
|
||||
}
|
||||
|
||||
return function (cipher) {
|
||||
return {
|
||||
encrypt: function (message, key, cfg) {
|
||||
return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
|
||||
},
|
||||
|
||||
decrypt: function (ciphertext, key, cfg) {
|
||||
return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
|
||||
}
|
||||
};
|
||||
};
|
||||
}())
|
||||
});
|
||||
|
||||
/**
|
||||
* Abstract base stream cipher template.
|
||||
*
|
||||
* @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
|
||||
*/
|
||||
var StreamCipher = C_lib.StreamCipher = Cipher.extend({
|
||||
_doFinalize: function () {
|
||||
// Process partial blocks
|
||||
var finalProcessedBlocks = this._process(!!'flush');
|
||||
|
||||
return finalProcessedBlocks;
|
||||
},
|
||||
|
||||
blockSize: 1
|
||||
});
|
||||
|
||||
/**
|
||||
* Mode namespace.
|
||||
*/
|
||||
var C_mode = C.mode = {};
|
||||
|
||||
/**
|
||||
* Abstract base block cipher mode template.
|
||||
*/
|
||||
var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
|
||||
/**
|
||||
* Creates this mode for encryption.
|
||||
*
|
||||
* @param {Cipher} cipher A block cipher instance.
|
||||
* @param {Array} iv The IV words.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
|
||||
*/
|
||||
createEncryptor: function (cipher, iv) {
|
||||
return this.Encryptor.create(cipher, iv);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates this mode for decryption.
|
||||
*
|
||||
* @param {Cipher} cipher A block cipher instance.
|
||||
* @param {Array} iv The IV words.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
|
||||
*/
|
||||
createDecryptor: function (cipher, iv) {
|
||||
return this.Decryptor.create(cipher, iv);
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes a newly created mode.
|
||||
*
|
||||
* @param {Cipher} cipher A block cipher instance.
|
||||
* @param {Array} iv The IV words.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
|
||||
*/
|
||||
init: function (cipher, iv) {
|
||||
this._cipher = cipher;
|
||||
this._iv = iv;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Cipher Block Chaining mode.
|
||||
*/
|
||||
var CBC = C_mode.CBC = (function () {
|
||||
/**
|
||||
* Abstract base CBC mode.
|
||||
*/
|
||||
var CBC = BlockCipherMode.extend();
|
||||
|
||||
/**
|
||||
* CBC encryptor.
|
||||
*/
|
||||
CBC.Encryptor = CBC.extend({
|
||||
/**
|
||||
* Processes the data block at offset.
|
||||
*
|
||||
* @param {Array} words The data words to operate on.
|
||||
* @param {number} offset The offset where the block starts.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* mode.processBlock(data.words, offset);
|
||||
*/
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher;
|
||||
var blockSize = cipher.blockSize;
|
||||
|
||||
// XOR and encrypt
|
||||
xorBlock.call(this, words, offset, blockSize);
|
||||
cipher.encryptBlock(words, offset);
|
||||
|
||||
// Remember this block to use with next block
|
||||
this._prevBlock = words.slice(offset, offset + blockSize);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* CBC decryptor.
|
||||
*/
|
||||
CBC.Decryptor = CBC.extend({
|
||||
/**
|
||||
* Processes the data block at offset.
|
||||
*
|
||||
* @param {Array} words The data words to operate on.
|
||||
* @param {number} offset The offset where the block starts.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* mode.processBlock(data.words, offset);
|
||||
*/
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher;
|
||||
var blockSize = cipher.blockSize;
|
||||
|
||||
// Remember this block to use with next block
|
||||
var thisBlock = words.slice(offset, offset + blockSize);
|
||||
|
||||
// Decrypt and XOR
|
||||
cipher.decryptBlock(words, offset);
|
||||
xorBlock.call(this, words, offset, blockSize);
|
||||
|
||||
// This block becomes the previous block
|
||||
this._prevBlock = thisBlock;
|
||||
}
|
||||
});
|
||||
|
||||
function xorBlock(words, offset, blockSize) {
|
||||
var block;
|
||||
|
||||
// Shortcut
|
||||
var iv = this._iv;
|
||||
|
||||
// Choose mixing block
|
||||
if (iv) {
|
||||
block = iv;
|
||||
|
||||
// Remove IV for subsequent blocks
|
||||
this._iv = undefined;
|
||||
} else {
|
||||
block = this._prevBlock;
|
||||
}
|
||||
|
||||
// XOR blocks
|
||||
for (var i = 0; i < blockSize; i++) {
|
||||
words[offset + i] ^= block[i];
|
||||
}
|
||||
}
|
||||
|
||||
return CBC;
|
||||
}());
|
||||
|
||||
/**
|
||||
* Padding namespace.
|
||||
*/
|
||||
var C_pad = C.pad = {};
|
||||
|
||||
/**
|
||||
* PKCS #5/7 padding strategy.
|
||||
*/
|
||||
var Pkcs7 = C_pad.Pkcs7 = {
|
||||
/**
|
||||
* Pads data using the algorithm defined in PKCS #5/7.
|
||||
*
|
||||
* @param {WordArray} data The data to pad.
|
||||
* @param {number} blockSize The multiple that the data should be padded to.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* CryptoJS.pad.Pkcs7.pad(wordArray, 4);
|
||||
*/
|
||||
pad: function (data, blockSize) {
|
||||
// Shortcut
|
||||
var blockSizeBytes = blockSize * 4;
|
||||
|
||||
// Count padding bytes
|
||||
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
||||
|
||||
// Create padding word
|
||||
var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
|
||||
|
||||
// Create padding
|
||||
var paddingWords = [];
|
||||
for (var i = 0; i < nPaddingBytes; i += 4) {
|
||||
paddingWords.push(paddingWord);
|
||||
}
|
||||
var padding = WordArray.create(paddingWords, nPaddingBytes);
|
||||
|
||||
// Add padding
|
||||
data.concat(padding);
|
||||
},
|
||||
|
||||
/**
|
||||
* Unpads data that had been padded using the algorithm defined in PKCS #5/7.
|
||||
*
|
||||
* @param {WordArray} data The data to unpad.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* CryptoJS.pad.Pkcs7.unpad(wordArray);
|
||||
*/
|
||||
unpad: function (data) {
|
||||
// Get number of padding bytes from last byte
|
||||
var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
||||
|
||||
// Remove padding
|
||||
data.sigBytes -= nPaddingBytes;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract base block cipher template.
|
||||
*
|
||||
* @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
|
||||
*/
|
||||
var BlockCipher = C_lib.BlockCipher = Cipher.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {Mode} mode The block mode to use. Default: CBC
|
||||
* @property {Padding} padding The padding strategy to use. Default: Pkcs7
|
||||
*/
|
||||
cfg: Cipher.cfg.extend({
|
||||
mode: CBC,
|
||||
padding: Pkcs7
|
||||
}),
|
||||
|
||||
reset: function () {
|
||||
var modeCreator;
|
||||
|
||||
// Reset cipher
|
||||
Cipher.reset.call(this);
|
||||
|
||||
// Shortcuts
|
||||
var cfg = this.cfg;
|
||||
var iv = cfg.iv;
|
||||
var mode = cfg.mode;
|
||||
|
||||
// Reset block mode
|
||||
if (this._xformMode == this._ENC_XFORM_MODE) {
|
||||
modeCreator = mode.createEncryptor;
|
||||
} else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
|
||||
modeCreator = mode.createDecryptor;
|
||||
// Keep at least one block in the buffer for unpadding
|
||||
this._minBufferSize = 1;
|
||||
}
|
||||
|
||||
if (this._mode && this._mode.__creator == modeCreator) {
|
||||
this._mode.init(this, iv && iv.words);
|
||||
} else {
|
||||
this._mode = modeCreator.call(mode, this, iv && iv.words);
|
||||
this._mode.__creator = modeCreator;
|
||||
}
|
||||
},
|
||||
|
||||
_doProcessBlock: function (words, offset) {
|
||||
this._mode.processBlock(words, offset);
|
||||
},
|
||||
|
||||
_doFinalize: function () {
|
||||
var finalProcessedBlocks;
|
||||
|
||||
// Shortcut
|
||||
var padding = this.cfg.padding;
|
||||
|
||||
// Finalize
|
||||
if (this._xformMode == this._ENC_XFORM_MODE) {
|
||||
// Pad data
|
||||
padding.pad(this._data, this.blockSize);
|
||||
|
||||
// Process final blocks
|
||||
finalProcessedBlocks = this._process(!!'flush');
|
||||
} else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
|
||||
// Process final blocks
|
||||
finalProcessedBlocks = this._process(!!'flush');
|
||||
|
||||
// Unpad data
|
||||
padding.unpad(finalProcessedBlocks);
|
||||
}
|
||||
|
||||
return finalProcessedBlocks;
|
||||
},
|
||||
|
||||
blockSize: 128/32
|
||||
});
|
||||
|
||||
/**
|
||||
* A collection of cipher parameters.
|
||||
*
|
||||
* @property {WordArray} ciphertext The raw ciphertext.
|
||||
* @property {WordArray} key The key to this ciphertext.
|
||||
* @property {WordArray} iv The IV used in the ciphering operation.
|
||||
* @property {WordArray} salt The salt used with a key derivation function.
|
||||
* @property {Cipher} algorithm The cipher algorithm.
|
||||
* @property {Mode} mode The block mode used in the ciphering operation.
|
||||
* @property {Padding} padding The padding scheme used in the ciphering operation.
|
||||
* @property {number} blockSize The block size of the cipher.
|
||||
* @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
|
||||
*/
|
||||
var CipherParams = C_lib.CipherParams = Base.extend({
|
||||
/**
|
||||
* Initializes a newly created cipher params object.
|
||||
*
|
||||
* @param {Object} cipherParams An object with any of the possible cipher parameters.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var cipherParams = CryptoJS.lib.CipherParams.create({
|
||||
* ciphertext: ciphertextWordArray,
|
||||
* key: keyWordArray,
|
||||
* iv: ivWordArray,
|
||||
* salt: saltWordArray,
|
||||
* algorithm: CryptoJS.algo.AES,
|
||||
* mode: CryptoJS.mode.CBC,
|
||||
* padding: CryptoJS.pad.PKCS7,
|
||||
* blockSize: 4,
|
||||
* formatter: CryptoJS.format.OpenSSL
|
||||
* });
|
||||
*/
|
||||
init: function (cipherParams) {
|
||||
this.mixIn(cipherParams);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts this cipher params object to a string.
|
||||
*
|
||||
* @param {Format} formatter (Optional) The formatting strategy to use.
|
||||
*
|
||||
* @return {string} The stringified cipher params.
|
||||
*
|
||||
* @throws Error If neither the formatter nor the default formatter is set.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var string = cipherParams + '';
|
||||
* var string = cipherParams.toString();
|
||||
* var string = cipherParams.toString(CryptoJS.format.OpenSSL);
|
||||
*/
|
||||
toString: function (formatter) {
|
||||
return (formatter || this.formatter).stringify(this);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Format namespace.
|
||||
*/
|
||||
var C_format = C.format = {};
|
||||
|
||||
/**
|
||||
* OpenSSL formatting strategy.
|
||||
*/
|
||||
var OpenSSLFormatter = C_format.OpenSSL = {
|
||||
/**
|
||||
* Converts a cipher params object to an OpenSSL-compatible string.
|
||||
*
|
||||
* @param {CipherParams} cipherParams The cipher params object.
|
||||
*
|
||||
* @return {string} The OpenSSL-compatible string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
|
||||
*/
|
||||
stringify: function (cipherParams) {
|
||||
var wordArray;
|
||||
|
||||
// Shortcuts
|
||||
var ciphertext = cipherParams.ciphertext;
|
||||
var salt = cipherParams.salt;
|
||||
|
||||
// Format
|
||||
if (salt) {
|
||||
wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
|
||||
} else {
|
||||
wordArray = ciphertext;
|
||||
}
|
||||
|
||||
return wordArray.toString(Base64);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts an OpenSSL-compatible string to a cipher params object.
|
||||
*
|
||||
* @param {string} openSSLStr The OpenSSL-compatible string.
|
||||
*
|
||||
* @return {CipherParams} The cipher params object.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
|
||||
*/
|
||||
parse: function (openSSLStr) {
|
||||
var salt;
|
||||
|
||||
// Parse base64
|
||||
var ciphertext = Base64.parse(openSSLStr);
|
||||
|
||||
// Shortcut
|
||||
var ciphertextWords = ciphertext.words;
|
||||
|
||||
// Test for salt
|
||||
if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
|
||||
// Extract salt
|
||||
salt = WordArray.create(ciphertextWords.slice(2, 4));
|
||||
|
||||
// Remove salt from ciphertext
|
||||
ciphertextWords.splice(0, 4);
|
||||
ciphertext.sigBytes -= 16;
|
||||
}
|
||||
|
||||
return CipherParams.create({ ciphertext: ciphertext, salt: salt });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A cipher wrapper that returns ciphertext as a serializable cipher params object.
|
||||
*/
|
||||
var SerializableCipher = C_lib.SerializableCipher = Base.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
|
||||
*/
|
||||
cfg: Base.extend({
|
||||
format: OpenSSLFormatter
|
||||
}),
|
||||
|
||||
/**
|
||||
* Encrypts a message.
|
||||
*
|
||||
* @param {Cipher} cipher The cipher algorithm to use.
|
||||
* @param {WordArray|string} message The message to encrypt.
|
||||
* @param {WordArray} key The key.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @return {CipherParams} A cipher params object.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
|
||||
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
|
||||
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
||||
*/
|
||||
encrypt: function (cipher, message, key, cfg) {
|
||||
// Apply config defaults
|
||||
cfg = this.cfg.extend(cfg);
|
||||
|
||||
// Encrypt
|
||||
var encryptor = cipher.createEncryptor(key, cfg);
|
||||
var ciphertext = encryptor.finalize(message);
|
||||
|
||||
// Shortcut
|
||||
var cipherCfg = encryptor.cfg;
|
||||
|
||||
// Create and return serializable cipher params
|
||||
return CipherParams.create({
|
||||
ciphertext: ciphertext,
|
||||
key: key,
|
||||
iv: cipherCfg.iv,
|
||||
algorithm: cipher,
|
||||
mode: cipherCfg.mode,
|
||||
padding: cipherCfg.padding,
|
||||
blockSize: cipher.blockSize,
|
||||
formatter: cfg.format
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Decrypts serialized ciphertext.
|
||||
*
|
||||
* @param {Cipher} cipher The cipher algorithm to use.
|
||||
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
||||
* @param {WordArray} key The key.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @return {WordArray} The plaintext.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
||||
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
||||
*/
|
||||
decrypt: function (cipher, ciphertext, key, cfg) {
|
||||
// Apply config defaults
|
||||
cfg = this.cfg.extend(cfg);
|
||||
|
||||
// Convert string to CipherParams
|
||||
ciphertext = this._parse(ciphertext, cfg.format);
|
||||
|
||||
// Decrypt
|
||||
var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
|
||||
|
||||
return plaintext;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts serialized ciphertext to CipherParams,
|
||||
* else assumed CipherParams already and returns ciphertext unchanged.
|
||||
*
|
||||
* @param {CipherParams|string} ciphertext The ciphertext.
|
||||
* @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
|
||||
*
|
||||
* @return {CipherParams} The unserialized ciphertext.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
|
||||
*/
|
||||
_parse: function (ciphertext, format) {
|
||||
if (typeof ciphertext == 'string') {
|
||||
return format.parse(ciphertext, this);
|
||||
} else {
|
||||
return ciphertext;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Key derivation function namespace.
|
||||
*/
|
||||
var C_kdf = C.kdf = {};
|
||||
|
||||
/**
|
||||
* OpenSSL key derivation function.
|
||||
*/
|
||||
var OpenSSLKdf = C_kdf.OpenSSL = {
|
||||
/**
|
||||
* Derives a key and IV from a password.
|
||||
*
|
||||
* @param {string} password The password to derive from.
|
||||
* @param {number} keySize The size in words of the key to generate.
|
||||
* @param {number} ivSize The size in words of the IV to generate.
|
||||
* @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
|
||||
*
|
||||
* @return {CipherParams} A cipher params object with the key, IV, and salt.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
|
||||
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
|
||||
*/
|
||||
execute: function (password, keySize, ivSize, salt) {
|
||||
// Generate random salt
|
||||
if (!salt) {
|
||||
salt = WordArray.random(64/8);
|
||||
}
|
||||
|
||||
// Derive key and IV
|
||||
var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
||||
|
||||
// Separate key and IV
|
||||
var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
|
||||
key.sigBytes = keySize * 4;
|
||||
|
||||
// Return params
|
||||
return CipherParams.create({ key: key, iv: iv, salt: salt });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A serializable cipher wrapper that derives the key from a password,
|
||||
* and returns ciphertext as a serializable cipher params object.
|
||||
*/
|
||||
var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
|
||||
*/
|
||||
cfg: SerializableCipher.cfg.extend({
|
||||
kdf: OpenSSLKdf
|
||||
}),
|
||||
|
||||
/**
|
||||
* Encrypts a message using a password.
|
||||
*
|
||||
* @param {Cipher} cipher The cipher algorithm to use.
|
||||
* @param {WordArray|string} message The message to encrypt.
|
||||
* @param {string} password The password.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @return {CipherParams} A cipher params object.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
|
||||
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
|
||||
*/
|
||||
encrypt: function (cipher, message, password, cfg) {
|
||||
// Apply config defaults
|
||||
cfg = this.cfg.extend(cfg);
|
||||
|
||||
// Derive key and other params
|
||||
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
|
||||
|
||||
// Add IV to config
|
||||
cfg.iv = derivedParams.iv;
|
||||
|
||||
// Encrypt
|
||||
var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
|
||||
|
||||
// Mix in derived params
|
||||
ciphertext.mixIn(derivedParams);
|
||||
|
||||
return ciphertext;
|
||||
},
|
||||
|
||||
/**
|
||||
* Decrypts serialized ciphertext using a password.
|
||||
*
|
||||
* @param {Cipher} cipher The cipher algorithm to use.
|
||||
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
||||
* @param {string} password The password.
|
||||
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
||||
*
|
||||
* @return {WordArray} The plaintext.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
|
||||
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
|
||||
*/
|
||||
decrypt: function (cipher, ciphertext, password, cfg) {
|
||||
// Apply config defaults
|
||||
cfg = this.cfg.extend(cfg);
|
||||
|
||||
// Convert string to CipherParams
|
||||
ciphertext = this._parse(ciphertext, cfg.format);
|
||||
|
||||
// Derive key and other params
|
||||
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
|
||||
|
||||
// Add IV to config
|
||||
cfg.iv = derivedParams.iv;
|
||||
|
||||
// Decrypt
|
||||
var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
|
||||
|
||||
return plaintext;
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* Cipher Feedback block mode.
|
||||
*/
|
||||
CryptoJS.mode.CFB = (function () {
|
||||
var CFB = CryptoJS.lib.BlockCipherMode.extend();
|
||||
|
||||
CFB.Encryptor = CFB.extend({
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher;
|
||||
var blockSize = cipher.blockSize;
|
||||
|
||||
generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
|
||||
|
||||
// Remember this block to use with next block
|
||||
this._prevBlock = words.slice(offset, offset + blockSize);
|
||||
}
|
||||
});
|
||||
|
||||
CFB.Decryptor = CFB.extend({
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher;
|
||||
var blockSize = cipher.blockSize;
|
||||
|
||||
// Remember this block to use with next block
|
||||
var thisBlock = words.slice(offset, offset + blockSize);
|
||||
|
||||
generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
|
||||
|
||||
// This block becomes the previous block
|
||||
this._prevBlock = thisBlock;
|
||||
}
|
||||
});
|
||||
|
||||
function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
|
||||
var keystream;
|
||||
|
||||
// Shortcut
|
||||
var iv = this._iv;
|
||||
|
||||
// Generate keystream
|
||||
if (iv) {
|
||||
keystream = iv.slice(0);
|
||||
|
||||
// Remove IV for subsequent blocks
|
||||
this._iv = undefined;
|
||||
} else {
|
||||
keystream = this._prevBlock;
|
||||
}
|
||||
cipher.encryptBlock(keystream, 0);
|
||||
|
||||
// Encrypt
|
||||
for (var i = 0; i < blockSize; i++) {
|
||||
words[offset + i] ^= keystream[i];
|
||||
}
|
||||
}
|
||||
|
||||
return CFB;
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* Counter block mode.
|
||||
*/
|
||||
CryptoJS.mode.CTR = (function () {
|
||||
var CTR = CryptoJS.lib.BlockCipherMode.extend();
|
||||
|
||||
var Encryptor = CTR.Encryptor = CTR.extend({
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher
|
||||
var blockSize = cipher.blockSize;
|
||||
var iv = this._iv;
|
||||
var counter = this._counter;
|
||||
|
||||
// Generate keystream
|
||||
if (iv) {
|
||||
counter = this._counter = iv.slice(0);
|
||||
|
||||
// Remove IV for subsequent blocks
|
||||
this._iv = undefined;
|
||||
}
|
||||
var keystream = counter.slice(0);
|
||||
cipher.encryptBlock(keystream, 0);
|
||||
|
||||
// Increment counter
|
||||
counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
|
||||
|
||||
// Encrypt
|
||||
for (var i = 0; i < blockSize; i++) {
|
||||
words[offset + i] ^= keystream[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CTR.Decryptor = Encryptor;
|
||||
|
||||
return CTR;
|
||||
}());
|
||||
|
||||
|
||||
/** @preserve
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby [email protected]
|
||||
*/
|
||||
CryptoJS.mode.CTRGladman = (function () {
|
||||
var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
|
||||
|
||||
function incWord(word)
|
||||
{
|
||||
if (((word >> 24) & 0xff) === 0xff) { //overflow
|
||||
var b1 = (word >> 16)&0xff;
|
||||
var b2 = (word >> 8)&0xff;
|
||||
var b3 = word & 0xff;
|
||||
|
||||
if (b1 === 0xff) // overflow b1
|
||||
{
|
||||
b1 = 0;
|
||||
if (b2 === 0xff)
|
||||
{
|
||||
b2 = 0;
|
||||
if (b3 === 0xff)
|
||||
{
|
||||
b3 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
++b3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++b2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++b1;
|
||||
}
|
||||
|
||||
word = 0;
|
||||
word += (b1 << 16);
|
||||
word += (b2 << 8);
|
||||
word += b3;
|
||||
}
|
||||
else
|
||||
{
|
||||
word += (0x01 << 24);
|
||||
}
|
||||
return word;
|
||||
}
|
||||
|
||||
function incCounter(counter)
|
||||
{
|
||||
if ((counter[0] = incWord(counter[0])) === 0)
|
||||
{
|
||||
// encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
|
||||
counter[1] = incWord(counter[1]);
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher
|
||||
var blockSize = cipher.blockSize;
|
||||
var iv = this._iv;
|
||||
var counter = this._counter;
|
||||
|
||||
// Generate keystream
|
||||
if (iv) {
|
||||
counter = this._counter = iv.slice(0);
|
||||
|
||||
// Remove IV for subsequent blocks
|
||||
this._iv = undefined;
|
||||
}
|
||||
|
||||
incCounter(counter);
|
||||
|
||||
var keystream = counter.slice(0);
|
||||
cipher.encryptBlock(keystream, 0);
|
||||
|
||||
// Encrypt
|
||||
for (var i = 0; i < blockSize; i++) {
|
||||
words[offset + i] ^= keystream[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CTRGladman.Decryptor = Encryptor;
|
||||
|
||||
return CTRGladman;
|
||||
}());
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Output Feedback block mode.
|
||||
*/
|
||||
CryptoJS.mode.OFB = (function () {
|
||||
var OFB = CryptoJS.lib.BlockCipherMode.extend();
|
||||
|
||||
var Encryptor = OFB.Encryptor = OFB.extend({
|
||||
processBlock: function (words, offset) {
|
||||
// Shortcuts
|
||||
var cipher = this._cipher
|
||||
var blockSize = cipher.blockSize;
|
||||
var iv = this._iv;
|
||||
var keystream = this._keystream;
|
||||
|
||||
// Generate keystream
|
||||
if (iv) {
|
||||
keystream = this._keystream = iv.slice(0);
|
||||
|
||||
// Remove IV for subsequent blocks
|
||||
this._iv = undefined;
|
||||
}
|
||||
cipher.encryptBlock(keystream, 0);
|
||||
|
||||
// Encrypt
|
||||
for (var i = 0; i < blockSize; i++) {
|
||||
words[offset + i] ^= keystream[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
OFB.Decryptor = Encryptor;
|
||||
|
||||
return OFB;
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* Electronic Codebook block mode.
|
||||
*/
|
||||
CryptoJS.mode.ECB = (function () {
|
||||
var ECB = CryptoJS.lib.BlockCipherMode.extend();
|
||||
|
||||
ECB.Encryptor = ECB.extend({
|
||||
processBlock: function (words, offset) {
|
||||
this._cipher.encryptBlock(words, offset);
|
||||
}
|
||||
});
|
||||
|
||||
ECB.Decryptor = ECB.extend({
|
||||
processBlock: function (words, offset) {
|
||||
this._cipher.decryptBlock(words, offset);
|
||||
}
|
||||
});
|
||||
|
||||
return ECB;
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* ANSI X.923 padding strategy.
|
||||
*/
|
||||
CryptoJS.pad.AnsiX923 = {
|
||||
pad: function (data, blockSize) {
|
||||
// Shortcuts
|
||||
var dataSigBytes = data.sigBytes;
|
||||
var blockSizeBytes = blockSize * 4;
|
||||
|
||||
// Count padding bytes
|
||||
var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
|
||||
|
||||
// Compute last byte position
|
||||
var lastBytePos = dataSigBytes + nPaddingBytes - 1;
|
||||
|
||||
// Pad
|
||||
data.clamp();
|
||||
data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
|
||||
data.sigBytes += nPaddingBytes;
|
||||
},
|
||||
|
||||
unpad: function (data) {
|
||||
// Get number of padding bytes from last byte
|
||||
var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
||||
|
||||
// Remove padding
|
||||
data.sigBytes -= nPaddingBytes;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISO 10126 padding strategy.
|
||||
*/
|
||||
CryptoJS.pad.Iso10126 = {
|
||||
pad: function (data, blockSize) {
|
||||
// Shortcut
|
||||
var blockSizeBytes = blockSize * 4;
|
||||
|
||||
// Count padding bytes
|
||||
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
||||
|
||||
// Pad
|
||||
data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
|
||||
concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
|
||||
},
|
||||
|
||||
unpad: function (data) {
|
||||
// Get number of padding bytes from last byte
|
||||
var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
|
||||
|
||||
// Remove padding
|
||||
data.sigBytes -= nPaddingBytes;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ISO/IEC 9797-1 Padding Method 2.
|
||||
*/
|
||||
CryptoJS.pad.Iso97971 = {
|
||||
pad: function (data, blockSize) {
|
||||
// Add 0x80 byte
|
||||
data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
|
||||
|
||||
// Zero pad the rest
|
||||
CryptoJS.pad.ZeroPadding.pad(data, blockSize);
|
||||
},
|
||||
|
||||
unpad: function (data) {
|
||||
// Remove zero padding
|
||||
CryptoJS.pad.ZeroPadding.unpad(data);
|
||||
|
||||
// Remove one more byte -- the 0x80 byte
|
||||
data.sigBytes--;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Zero padding strategy.
|
||||
*/
|
||||
CryptoJS.pad.ZeroPadding = {
|
||||
pad: function (data, blockSize) {
|
||||
// Shortcut
|
||||
var blockSizeBytes = blockSize * 4;
|
||||
|
||||
// Pad
|
||||
data.clamp();
|
||||
data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
|
||||
},
|
||||
|
||||
unpad: function (data) {
|
||||
// Shortcut
|
||||
var dataWords = data.words;
|
||||
|
||||
// Unpad
|
||||
var i = data.sigBytes - 1;
|
||||
for (var i = data.sigBytes - 1; i >= 0; i--) {
|
||||
if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
|
||||
data.sigBytes = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A noop padding strategy.
|
||||
*/
|
||||
CryptoJS.pad.NoPadding = {
|
||||
pad: function () {
|
||||
},
|
||||
|
||||
unpad: function () {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
(function (undefined) {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var CipherParams = C_lib.CipherParams;
|
||||
var C_enc = C.enc;
|
||||
var Hex = C_enc.Hex;
|
||||
var C_format = C.format;
|
||||
|
||||
var HexFormatter = C_format.Hex = {
|
||||
/**
|
||||
* Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
|
||||
*
|
||||
* @param {CipherParams} cipherParams The cipher params object.
|
||||
*
|
||||
* @return {string} The hexadecimally encoded string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var hexString = CryptoJS.format.Hex.stringify(cipherParams);
|
||||
*/
|
||||
stringify: function (cipherParams) {
|
||||
return cipherParams.ciphertext.toString(Hex);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a hexadecimally encoded ciphertext string to a cipher params object.
|
||||
*
|
||||
* @param {string} input The hexadecimally encoded string.
|
||||
*
|
||||
* @return {CipherParams} The cipher params object.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var cipherParams = CryptoJS.format.Hex.parse(hexString);
|
||||
*/
|
||||
parse: function (input) {
|
||||
var ciphertext = Hex.parse(input);
|
||||
return CipherParams.create({ ciphertext: ciphertext });
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var BlockCipher = C_lib.BlockCipher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Lookup tables
|
||||
var SBOX = [];
|
||||
var INV_SBOX = [];
|
||||
var SUB_MIX_0 = [];
|
||||
var SUB_MIX_1 = [];
|
||||
var SUB_MIX_2 = [];
|
||||
var SUB_MIX_3 = [];
|
||||
var INV_SUB_MIX_0 = [];
|
||||
var INV_SUB_MIX_1 = [];
|
||||
var INV_SUB_MIX_2 = [];
|
||||
var INV_SUB_MIX_3 = [];
|
||||
|
||||
// Compute lookup tables
|
||||
(function () {
|
||||
// Compute double table
|
||||
var d = [];
|
||||
for (var i = 0; i < 256; i++) {
|
||||
if (i < 128) {
|
||||
d[i] = i << 1;
|
||||
} else {
|
||||
d[i] = (i << 1) ^ 0x11b;
|
||||
}
|
||||
}
|
||||
|
||||
// Walk GF(2^8)
|
||||
var x = 0;
|
||||
var xi = 0;
|
||||
for (var i = 0; i < 256; i++) {
|
||||
// Compute sbox
|
||||
var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
|
||||
sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
|
||||
SBOX[x] = sx;
|
||||
INV_SBOX[sx] = x;
|
||||
|
||||
// Compute multiplication
|
||||
var x2 = d[x];
|
||||
var x4 = d[x2];
|
||||
var x8 = d[x4];
|
||||
|
||||
// Compute sub bytes, mix columns tables
|
||||
var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
|
||||
SUB_MIX_0[x] = (t << 24) | (t >>> 8);
|
||||
SUB_MIX_1[x] = (t << 16) | (t >>> 16);
|
||||
SUB_MIX_2[x] = (t << 8) | (t >>> 24);
|
||||
SUB_MIX_3[x] = t;
|
||||
|
||||
// Compute inv sub bytes, inv mix columns tables
|
||||
var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
|
||||
INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
|
||||
INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
|
||||
INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
|
||||
INV_SUB_MIX_3[sx] = t;
|
||||
|
||||
// Compute next counter
|
||||
if (!x) {
|
||||
x = xi = 1;
|
||||
} else {
|
||||
x = x2 ^ d[d[d[x8 ^ x2]]];
|
||||
xi ^= d[d[xi]];
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
||||
// Precomputed Rcon lookup
|
||||
var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
|
||||
|
||||
/**
|
||||
* AES block cipher algorithm.
|
||||
*/
|
||||
var AES = C_algo.AES = BlockCipher.extend({
|
||||
_doReset: function () {
|
||||
var t;
|
||||
|
||||
// Skip reset of nRounds has been set before and key did not change
|
||||
if (this._nRounds && this._keyPriorReset === this._key) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Shortcuts
|
||||
var key = this._keyPriorReset = this._key;
|
||||
var keyWords = key.words;
|
||||
var keySize = key.sigBytes / 4;
|
||||
|
||||
// Compute number of rounds
|
||||
var nRounds = this._nRounds = keySize + 6;
|
||||
|
||||
// Compute number of key schedule rows
|
||||
var ksRows = (nRounds + 1) * 4;
|
||||
|
||||
// Compute key schedule
|
||||
var keySchedule = this._keySchedule = [];
|
||||
for (var ksRow = 0; ksRow < ksRows; ksRow++) {
|
||||
if (ksRow < keySize) {
|
||||
keySchedule[ksRow] = keyWords[ksRow];
|
||||
} else {
|
||||
t = keySchedule[ksRow - 1];
|
||||
|
||||
if (!(ksRow % keySize)) {
|
||||
// Rot word
|
||||
t = (t << 8) | (t >>> 24);
|
||||
|
||||
// Sub word
|
||||
t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
|
||||
|
||||
// Mix Rcon
|
||||
t ^= RCON[(ksRow / keySize) | 0] << 24;
|
||||
} else if (keySize > 6 && ksRow % keySize == 4) {
|
||||
// Sub word
|
||||
t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
|
||||
}
|
||||
|
||||
keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
|
||||
}
|
||||
}
|
||||
|
||||
// Compute inv key schedule
|
||||
var invKeySchedule = this._invKeySchedule = [];
|
||||
for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
|
||||
var ksRow = ksRows - invKsRow;
|
||||
|
||||
if (invKsRow % 4) {
|
||||
var t = keySchedule[ksRow];
|
||||
} else {
|
||||
var t = keySchedule[ksRow - 4];
|
||||
}
|
||||
|
||||
if (invKsRow < 4 || ksRow <= 4) {
|
||||
invKeySchedule[invKsRow] = t;
|
||||
} else {
|
||||
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
|
||||
INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
encryptBlock: function (M, offset) {
|
||||
this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
|
||||
},
|
||||
|
||||
decryptBlock: function (M, offset) {
|
||||
// Swap 2nd and 4th rows
|
||||
var t = M[offset + 1];
|
||||
M[offset + 1] = M[offset + 3];
|
||||
M[offset + 3] = t;
|
||||
|
||||
this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
|
||||
|
||||
// Inv swap 2nd and 4th rows
|
||||
var t = M[offset + 1];
|
||||
M[offset + 1] = M[offset + 3];
|
||||
M[offset + 3] = t;
|
||||
},
|
||||
|
||||
_doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
|
||||
// Shortcut
|
||||
var nRounds = this._nRounds;
|
||||
|
||||
// Get input, add round key
|
||||
var s0 = M[offset] ^ keySchedule[0];
|
||||
var s1 = M[offset + 1] ^ keySchedule[1];
|
||||
var s2 = M[offset + 2] ^ keySchedule[2];
|
||||
var s3 = M[offset + 3] ^ keySchedule[3];
|
||||
|
||||
// Key schedule row counter
|
||||
var ksRow = 4;
|
||||
|
||||
// Rounds
|
||||
for (var round = 1; round < nRounds; round++) {
|
||||
// Shift rows, sub bytes, mix columns, add round key
|
||||
var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
|
||||
var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
|
||||
var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
|
||||
var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
|
||||
|
||||
// Update state
|
||||
s0 = t0;
|
||||
s1 = t1;
|
||||
s2 = t2;
|
||||
s3 = t3;
|
||||
}
|
||||
|
||||
// Shift rows, sub bytes, add round key
|
||||
var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
|
||||
var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
|
||||
var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
|
||||
var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
|
||||
|
||||
// Set output
|
||||
M[offset] = t0;
|
||||
M[offset + 1] = t1;
|
||||
M[offset + 2] = t2;
|
||||
M[offset + 3] = t3;
|
||||
},
|
||||
|
||||
keySize: 256/32
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.AES = BlockCipher._createHelper(AES);
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var WordArray = C_lib.WordArray;
|
||||
var BlockCipher = C_lib.BlockCipher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Permuted Choice 1 constants
|
||||
var PC1 = [
|
||||
57, 49, 41, 33, 25, 17, 9, 1,
|
||||
58, 50, 42, 34, 26, 18, 10, 2,
|
||||
59, 51, 43, 35, 27, 19, 11, 3,
|
||||
60, 52, 44, 36, 63, 55, 47, 39,
|
||||
31, 23, 15, 7, 62, 54, 46, 38,
|
||||
30, 22, 14, 6, 61, 53, 45, 37,
|
||||
29, 21, 13, 5, 28, 20, 12, 4
|
||||
];
|
||||
|
||||
// Permuted Choice 2 constants
|
||||
var PC2 = [
|
||||
14, 17, 11, 24, 1, 5,
|
||||
3, 28, 15, 6, 21, 10,
|
||||
23, 19, 12, 4, 26, 8,
|
||||
16, 7, 27, 20, 13, 2,
|
||||
41, 52, 31, 37, 47, 55,
|
||||
30, 40, 51, 45, 33, 48,
|
||||
44, 49, 39, 56, 34, 53,
|
||||
46, 42, 50, 36, 29, 32
|
||||
];
|
||||
|
||||
// Cumulative bit shift constants
|
||||
var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
|
||||
|
||||
// SBOXes and round permutation constants
|
||||
var SBOX_P = [
|
||||
{
|
||||
0x0: 0x808200,
|
||||
0x10000000: 0x8000,
|
||||
0x20000000: 0x808002,
|
||||
0x30000000: 0x2,
|
||||
0x40000000: 0x200,
|
||||
0x50000000: 0x808202,
|
||||
0x60000000: 0x800202,
|
||||
0x70000000: 0x800000,
|
||||
0x80000000: 0x202,
|
||||
0x90000000: 0x800200,
|
||||
0xa0000000: 0x8200,
|
||||
0xb0000000: 0x808000,
|
||||
0xc0000000: 0x8002,
|
||||
0xd0000000: 0x800002,
|
||||
0xe0000000: 0x0,
|
||||
0xf0000000: 0x8202,
|
||||
0x8000000: 0x0,
|
||||
0x18000000: 0x808202,
|
||||
0x28000000: 0x8202,
|
||||
0x38000000: 0x8000,
|
||||
0x48000000: 0x808200,
|
||||
0x58000000: 0x200,
|
||||
0x68000000: 0x808002,
|
||||
0x78000000: 0x2,
|
||||
0x88000000: 0x800200,
|
||||
0x98000000: 0x8200,
|
||||
0xa8000000: 0x808000,
|
||||
0xb8000000: 0x800202,
|
||||
0xc8000000: 0x800002,
|
||||
0xd8000000: 0x8002,
|
||||
0xe8000000: 0x202,
|
||||
0xf8000000: 0x800000,
|
||||
0x1: 0x8000,
|
||||
0x10000001: 0x2,
|
||||
0x20000001: 0x808200,
|
||||
0x30000001: 0x800000,
|
||||
0x40000001: 0x808002,
|
||||
0x50000001: 0x8200,
|
||||
0x60000001: 0x200,
|
||||
0x70000001: 0x800202,
|
||||
0x80000001: 0x808202,
|
||||
0x90000001: 0x808000,
|
||||
0xa0000001: 0x800002,
|
||||
0xb0000001: 0x8202,
|
||||
0xc0000001: 0x202,
|
||||
0xd0000001: 0x800200,
|
||||
0xe0000001: 0x8002,
|
||||
0xf0000001: 0x0,
|
||||
0x8000001: 0x808202,
|
||||
0x18000001: 0x808000,
|
||||
0x28000001: 0x800000,
|
||||
0x38000001: 0x200,
|
||||
0x48000001: 0x8000,
|
||||
0x58000001: 0x800002,
|
||||
0x68000001: 0x2,
|
||||
0x78000001: 0x8202,
|
||||
0x88000001: 0x8002,
|
||||
0x98000001: 0x800202,
|
||||
0xa8000001: 0x202,
|
||||
0xb8000001: 0x808200,
|
||||
0xc8000001: 0x800200,
|
||||
0xd8000001: 0x0,
|
||||
0xe8000001: 0x8200,
|
||||
0xf8000001: 0x808002
|
||||
},
|
||||
{
|
||||
0x0: 0x40084010,
|
||||
0x1000000: 0x4000,
|
||||
0x2000000: 0x80000,
|
||||
0x3000000: 0x40080010,
|
||||
0x4000000: 0x40000010,
|
||||
0x5000000: 0x40084000,
|
||||
0x6000000: 0x40004000,
|
||||
0x7000000: 0x10,
|
||||
0x8000000: 0x84000,
|
||||
0x9000000: 0x40004010,
|
||||
0xa000000: 0x40000000,
|
||||
0xb000000: 0x84010,
|
||||
0xc000000: 0x80010,
|
||||
0xd000000: 0x0,
|
||||
0xe000000: 0x4010,
|
||||
0xf000000: 0x40080000,
|
||||
0x800000: 0x40004000,
|
||||
0x1800000: 0x84010,
|
||||
0x2800000: 0x10,
|
||||
0x3800000: 0x40004010,
|
||||
0x4800000: 0x40084010,
|
||||
0x5800000: 0x40000000,
|
||||
0x6800000: 0x80000,
|
||||
0x7800000: 0x40080010,
|
||||
0x8800000: 0x80010,
|
||||
0x9800000: 0x0,
|
||||
0xa800000: 0x4000,
|
||||
0xb800000: 0x40080000,
|
||||
0xc800000: 0x40000010,
|
||||
0xd800000: 0x84000,
|
||||
0xe800000: 0x40084000,
|
||||
0xf800000: 0x4010,
|
||||
0x10000000: 0x0,
|
||||
0x11000000: 0x40080010,
|
||||
0x12000000: 0x40004010,
|
||||
0x13000000: 0x40084000,
|
||||
0x14000000: 0x40080000,
|
||||
0x15000000: 0x10,
|
||||
0x16000000: 0x84010,
|
||||
0x17000000: 0x4000,
|
||||
0x18000000: 0x4010,
|
||||
0x19000000: 0x80000,
|
||||
0x1a000000: 0x80010,
|
||||
0x1b000000: 0x40000010,
|
||||
0x1c000000: 0x84000,
|
||||
0x1d000000: 0x40004000,
|
||||
0x1e000000: 0x40000000,
|
||||
0x1f000000: 0x40084010,
|
||||
0x10800000: 0x84010,
|
||||
0x11800000: 0x80000,
|
||||
0x12800000: 0x40080000,
|
||||
0x13800000: 0x4000,
|
||||
0x14800000: 0x40004000,
|
||||
0x15800000: 0x40084010,
|
||||
0x16800000: 0x10,
|
||||
0x17800000: 0x40000000,
|
||||
0x18800000: 0x40084000,
|
||||
0x19800000: 0x40000010,
|
||||
0x1a800000: 0x40004010,
|
||||
0x1b800000: 0x80010,
|
||||
0x1c800000: 0x0,
|
||||
0x1d800000: 0x4010,
|
||||
0x1e800000: 0x40080010,
|
||||
0x1f800000: 0x84000
|
||||
},
|
||||
{
|
||||
0x0: 0x104,
|
||||
0x100000: 0x0,
|
||||
0x200000: 0x4000100,
|
||||
0x300000: 0x10104,
|
||||
0x400000: 0x10004,
|
||||
0x500000: 0x4000004,
|
||||
0x600000: 0x4010104,
|
||||
0x700000: 0x4010000,
|
||||
0x800000: 0x4000000,
|
||||
0x900000: 0x4010100,
|
||||
0xa00000: 0x10100,
|
||||
0xb00000: 0x4010004,
|
||||
0xc00000: 0x4000104,
|
||||
0xd00000: 0x10000,
|
||||
0xe00000: 0x4,
|
||||
0xf00000: 0x100,
|
||||
0x80000: 0x4010100,
|
||||
0x180000: 0x4010004,
|
||||
0x280000: 0x0,
|
||||
0x380000: 0x4000100,
|
||||
0x480000: 0x4000004,
|
||||
0x580000: 0x10000,
|
||||
0x680000: 0x10004,
|
||||
0x780000: 0x104,
|
||||
0x880000: 0x4,
|
||||
0x980000: 0x100,
|
||||
0xa80000: 0x4010000,
|
||||
0xb80000: 0x10104,
|
||||
0xc80000: 0x10100,
|
||||
0xd80000: 0x4000104,
|
||||
0xe80000: 0x4010104,
|
||||
0xf80000: 0x4000000,
|
||||
0x1000000: 0x4010100,
|
||||
0x1100000: 0x10004,
|
||||
0x1200000: 0x10000,
|
||||
0x1300000: 0x4000100,
|
||||
0x1400000: 0x100,
|
||||
0x1500000: 0x4010104,
|
||||
0x1600000: 0x4000004,
|
||||
0x1700000: 0x0,
|
||||
0x1800000: 0x4000104,
|
||||
0x1900000: 0x4000000,
|
||||
0x1a00000: 0x4,
|
||||
0x1b00000: 0x10100,
|
||||
0x1c00000: 0x4010000,
|
||||
0x1d00000: 0x104,
|
||||
0x1e00000: 0x10104,
|
||||
0x1f00000: 0x4010004,
|
||||
0x1080000: 0x4000000,
|
||||
0x1180000: 0x104,
|
||||
0x1280000: 0x4010100,
|
||||
0x1380000: 0x0,
|
||||
0x1480000: 0x10004,
|
||||
0x1580000: 0x4000100,
|
||||
0x1680000: 0x100,
|
||||
0x1780000: 0x4010004,
|
||||
0x1880000: 0x10000,
|
||||
0x1980000: 0x4010104,
|
||||
0x1a80000: 0x10104,
|
||||
0x1b80000: 0x4000004,
|
||||
0x1c80000: 0x4000104,
|
||||
0x1d80000: 0x4010000,
|
||||
0x1e80000: 0x4,
|
||||
0x1f80000: 0x10100
|
||||
},
|
||||
{
|
||||
0x0: 0x80401000,
|
||||
0x10000: 0x80001040,
|
||||
0x20000: 0x401040,
|
||||
0x30000: 0x80400000,
|
||||
0x40000: 0x0,
|
||||
0x50000: 0x401000,
|
||||
0x60000: 0x80000040,
|
||||
0x70000: 0x400040,
|
||||
0x80000: 0x80000000,
|
||||
0x90000: 0x400000,
|
||||
0xa0000: 0x40,
|
||||
0xb0000: 0x80001000,
|
||||
0xc0000: 0x80400040,
|
||||
0xd0000: 0x1040,
|
||||
0xe0000: 0x1000,
|
||||
0xf0000: 0x80401040,
|
||||
0x8000: 0x80001040,
|
||||
0x18000: 0x40,
|
||||
0x28000: 0x80400040,
|
||||
0x38000: 0x80001000,
|
||||
0x48000: 0x401000,
|
||||
0x58000: 0x80401040,
|
||||
0x68000: 0x0,
|
||||
0x78000: 0x80400000,
|
||||
0x88000: 0x1000,
|
||||
0x98000: 0x80401000,
|
||||
0xa8000: 0x400000,
|
||||
0xb8000: 0x1040,
|
||||
0xc8000: 0x80000000,
|
||||
0xd8000: 0x400040,
|
||||
0xe8000: 0x401040,
|
||||
0xf8000: 0x80000040,
|
||||
0x100000: 0x400040,
|
||||
0x110000: 0x401000,
|
||||
0x120000: 0x80000040,
|
||||
0x130000: 0x0,
|
||||
0x140000: 0x1040,
|
||||
0x150000: 0x80400040,
|
||||
0x160000: 0x80401000,
|
||||
0x170000: 0x80001040,
|
||||
0x180000: 0x80401040,
|
||||
0x190000: 0x80000000,
|
||||
0x1a0000: 0x80400000,
|
||||
0x1b0000: 0x401040,
|
||||
0x1c0000: 0x80001000,
|
||||
0x1d0000: 0x400000,
|
||||
0x1e0000: 0x40,
|
||||
0x1f0000: 0x1000,
|
||||
0x108000: 0x80400000,
|
||||
0x118000: 0x80401040,
|
||||
0x128000: 0x0,
|
||||
0x138000: 0x401000,
|
||||
0x148000: 0x400040,
|
||||
0x158000: 0x80000000,
|
||||
0x168000: 0x80001040,
|
||||
0x178000: 0x40,
|
||||
0x188000: 0x80000040,
|
||||
0x198000: 0x1000,
|
||||
0x1a8000: 0x80001000,
|
||||
0x1b8000: 0x80400040,
|
||||
0x1c8000: 0x1040,
|
||||
0x1d8000: 0x80401000,
|
||||
0x1e8000: 0x400000,
|
||||
0x1f8000: 0x401040
|
||||
},
|
||||
{
|
||||
0x0: 0x80,
|
||||
0x1000: 0x1040000,
|
||||
0x2000: 0x40000,
|
||||
0x3000: 0x20000000,
|
||||
0x4000: 0x20040080,
|
||||
0x5000: 0x1000080,
|
||||
0x6000: 0x21000080,
|
||||
0x7000: 0x40080,
|
||||
0x8000: 0x1000000,
|
||||
0x9000: 0x20040000,
|
||||
0xa000: 0x20000080,
|
||||
0xb000: 0x21040080,
|
||||
0xc000: 0x21040000,
|
||||
0xd000: 0x0,
|
||||
0xe000: 0x1040080,
|
||||
0xf000: 0x21000000,
|
||||
0x800: 0x1040080,
|
||||
0x1800: 0x21000080,
|
||||
0x2800: 0x80,
|
||||
0x3800: 0x1040000,
|
||||
0x4800: 0x40000,
|
||||
0x5800: 0x20040080,
|
||||
0x6800: 0x21040000,
|
||||
0x7800: 0x20000000,
|
||||
0x8800: 0x20040000,
|
||||
0x9800: 0x0,
|
||||
0xa800: 0x21040080,
|
||||
0xb800: 0x1000080,
|
||||
0xc800: 0x20000080,
|
||||
0xd800: 0x21000000,
|
||||
0xe800: 0x1000000,
|
||||
0xf800: 0x40080,
|
||||
0x10000: 0x40000,
|
||||
0x11000: 0x80,
|
||||
0x12000: 0x20000000,
|
||||
0x13000: 0x21000080,
|
||||
0x14000: 0x1000080,
|
||||
0x15000: 0x21040000,
|
||||
0x16000: 0x20040080,
|
||||
0x17000: 0x1000000,
|
||||
0x18000: 0x21040080,
|
||||
0x19000: 0x21000000,
|
||||
0x1a000: 0x1040000,
|
||||
0x1b000: 0x20040000,
|
||||
0x1c000: 0x40080,
|
||||
0x1d000: 0x20000080,
|
||||
0x1e000: 0x0,
|
||||
0x1f000: 0x1040080,
|
||||
0x10800: 0x21000080,
|
||||
0x11800: 0x1000000,
|
||||
0x12800: 0x1040000,
|
||||
0x13800: 0x20040080,
|
||||
0x14800: 0x20000000,
|
||||
0x15800: 0x1040080,
|
||||
0x16800: 0x80,
|
||||
0x17800: 0x21040000,
|
||||
0x18800: 0x40080,
|
||||
0x19800: 0x21040080,
|
||||
0x1a800: 0x0,
|
||||
0x1b800: 0x21000000,
|
||||
0x1c800: 0x1000080,
|
||||
0x1d800: 0x40000,
|
||||
0x1e800: 0x20040000,
|
||||
0x1f800: 0x20000080
|
||||
},
|
||||
{
|
||||
0x0: 0x10000008,
|
||||
0x100: 0x2000,
|
||||
0x200: 0x10200000,
|
||||
0x300: 0x10202008,
|
||||
0x400: 0x10002000,
|
||||
0x500: 0x200000,
|
||||
0x600: 0x200008,
|
||||
0x700: 0x10000000,
|
||||
0x800: 0x0,
|
||||
0x900: 0x10002008,
|
||||
0xa00: 0x202000,
|
||||
0xb00: 0x8,
|
||||
0xc00: 0x10200008,
|
||||
0xd00: 0x202008,
|
||||
0xe00: 0x2008,
|
||||
0xf00: 0x10202000,
|
||||
0x80: 0x10200000,
|
||||
0x180: 0x10202008,
|
||||
0x280: 0x8,
|
||||
0x380: 0x200000,
|
||||
0x480: 0x202008,
|
||||
0x580: 0x10000008,
|
||||
0x680: 0x10002000,
|
||||
0x780: 0x2008,
|
||||
0x880: 0x200008,
|
||||
0x980: 0x2000,
|
||||
0xa80: 0x10002008,
|
||||
0xb80: 0x10200008,
|
||||
0xc80: 0x0,
|
||||
0xd80: 0x10202000,
|
||||
0xe80: 0x202000,
|
||||
0xf80: 0x10000000,
|
||||
0x1000: 0x10002000,
|
||||
0x1100: 0x10200008,
|
||||
0x1200: 0x10202008,
|
||||
0x1300: 0x2008,
|
||||
0x1400: 0x200000,
|
||||
0x1500: 0x10000000,
|
||||
0x1600: 0x10000008,
|
||||
0x1700: 0x202000,
|
||||
0x1800: 0x202008,
|
||||
0x1900: 0x0,
|
||||
0x1a00: 0x8,
|
||||
0x1b00: 0x10200000,
|
||||
0x1c00: 0x2000,
|
||||
0x1d00: 0x10002008,
|
||||
0x1e00: 0x10202000,
|
||||
0x1f00: 0x200008,
|
||||
0x1080: 0x8,
|
||||
0x1180: 0x202000,
|
||||
0x1280: 0x200000,
|
||||
0x1380: 0x10000008,
|
||||
0x1480: 0x10002000,
|
||||
0x1580: 0x2008,
|
||||
0x1680: 0x10202008,
|
||||
0x1780: 0x10200000,
|
||||
0x1880: 0x10202000,
|
||||
0x1980: 0x10200008,
|
||||
0x1a80: 0x2000,
|
||||
0x1b80: 0x202008,
|
||||
0x1c80: 0x200008,
|
||||
0x1d80: 0x0,
|
||||
0x1e80: 0x10000000,
|
||||
0x1f80: 0x10002008
|
||||
},
|
||||
{
|
||||
0x0: 0x100000,
|
||||
0x10: 0x2000401,
|
||||
0x20: 0x400,
|
||||
0x30: 0x100401,
|
||||
0x40: 0x2100401,
|
||||
0x50: 0x0,
|
||||
0x60: 0x1,
|
||||
0x70: 0x2100001,
|
||||
0x80: 0x2000400,
|
||||
0x90: 0x100001,
|
||||
0xa0: 0x2000001,
|
||||
0xb0: 0x2100400,
|
||||
0xc0: 0x2100000,
|
||||
0xd0: 0x401,
|
||||
0xe0: 0x100400,
|
||||
0xf0: 0x2000000,
|
||||
0x8: 0x2100001,
|
||||
0x18: 0x0,
|
||||
0x28: 0x2000401,
|
||||
0x38: 0x2100400,
|
||||
0x48: 0x100000,
|
||||
0x58: 0x2000001,
|
||||
0x68: 0x2000000,
|
||||
0x78: 0x401,
|
||||
0x88: 0x100401,
|
||||
0x98: 0x2000400,
|
||||
0xa8: 0x2100000,
|
||||
0xb8: 0x100001,
|
||||
0xc8: 0x400,
|
||||
0xd8: 0x2100401,
|
||||
0xe8: 0x1,
|
||||
0xf8: 0x100400,
|
||||
0x100: 0x2000000,
|
||||
0x110: 0x100000,
|
||||
0x120: 0x2000401,
|
||||
0x130: 0x2100001,
|
||||
0x140: 0x100001,
|
||||
0x150: 0x2000400,
|
||||
0x160: 0x2100400,
|
||||
0x170: 0x100401,
|
||||
0x180: 0x401,
|
||||
0x190: 0x2100401,
|
||||
0x1a0: 0x100400,
|
||||
0x1b0: 0x1,
|
||||
0x1c0: 0x0,
|
||||
0x1d0: 0x2100000,
|
||||
0x1e0: 0x2000001,
|
||||
0x1f0: 0x400,
|
||||
0x108: 0x100400,
|
||||
0x118: 0x2000401,
|
||||
0x128: 0x2100001,
|
||||
0x138: 0x1,
|
||||
0x148: 0x2000000,
|
||||
0x158: 0x100000,
|
||||
0x168: 0x401,
|
||||
0x178: 0x2100400,
|
||||
0x188: 0x2000001,
|
||||
0x198: 0x2100000,
|
||||
0x1a8: 0x0,
|
||||
0x1b8: 0x2100401,
|
||||
0x1c8: 0x100401,
|
||||
0x1d8: 0x400,
|
||||
0x1e8: 0x2000400,
|
||||
0x1f8: 0x100001
|
||||
},
|
||||
{
|
||||
0x0: 0x8000820,
|
||||
0x1: 0x20000,
|
||||
0x2: 0x8000000,
|
||||
0x3: 0x20,
|
||||
0x4: 0x20020,
|
||||
0x5: 0x8020820,
|
||||
0x6: 0x8020800,
|
||||
0x7: 0x800,
|
||||
0x8: 0x8020000,
|
||||
0x9: 0x8000800,
|
||||
0xa: 0x20800,
|
||||
0xb: 0x8020020,
|
||||
0xc: 0x820,
|
||||
0xd: 0x0,
|
||||
0xe: 0x8000020,
|
||||
0xf: 0x20820,
|
||||
0x80000000: 0x800,
|
||||
0x80000001: 0x8020820,
|
||||
0x80000002: 0x8000820,
|
||||
0x80000003: 0x8000000,
|
||||
0x80000004: 0x8020000,
|
||||
0x80000005: 0x20800,
|
||||
0x80000006: 0x20820,
|
||||
0x80000007: 0x20,
|
||||
0x80000008: 0x8000020,
|
||||
0x80000009: 0x820,
|
||||
0x8000000a: 0x20020,
|
||||
0x8000000b: 0x8020800,
|
||||
0x8000000c: 0x0,
|
||||
0x8000000d: 0x8020020,
|
||||
0x8000000e: 0x8000800,
|
||||
0x8000000f: 0x20000,
|
||||
0x10: 0x20820,
|
||||
0x11: 0x8020800,
|
||||
0x12: 0x20,
|
||||
0x13: 0x800,
|
||||
0x14: 0x8000800,
|
||||
0x15: 0x8000020,
|
||||
0x16: 0x8020020,
|
||||
0x17: 0x20000,
|
||||
0x18: 0x0,
|
||||
0x19: 0x20020,
|
||||
0x1a: 0x8020000,
|
||||
0x1b: 0x8000820,
|
||||
0x1c: 0x8020820,
|
||||
0x1d: 0x20800,
|
||||
0x1e: 0x820,
|
||||
0x1f: 0x8000000,
|
||||
0x80000010: 0x20000,
|
||||
0x80000011: 0x800,
|
||||
0x80000012: 0x8020020,
|
||||
0x80000013: 0x20820,
|
||||
0x80000014: 0x20,
|
||||
0x80000015: 0x8020000,
|
||||
0x80000016: 0x8000000,
|
||||
0x80000017: 0x8000820,
|
||||
0x80000018: 0x8020820,
|
||||
0x80000019: 0x8000020,
|
||||
0x8000001a: 0x8000800,
|
||||
0x8000001b: 0x0,
|
||||
0x8000001c: 0x20800,
|
||||
0x8000001d: 0x820,
|
||||
0x8000001e: 0x20020,
|
||||
0x8000001f: 0x8020800
|
||||
}
|
||||
];
|
||||
|
||||
// Masks that select the SBOX input
|
||||
var SBOX_MASK = [
|
||||
0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
|
||||
0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
|
||||
];
|
||||
|
||||
/**
|
||||
* DES block cipher algorithm.
|
||||
*/
|
||||
var DES = C_algo.DES = BlockCipher.extend({
|
||||
_doReset: function () {
|
||||
// Shortcuts
|
||||
var key = this._key;
|
||||
var keyWords = key.words;
|
||||
|
||||
// Select 56 bits according to PC1
|
||||
var keyBits = [];
|
||||
for (var i = 0; i < 56; i++) {
|
||||
var keyBitPos = PC1[i] - 1;
|
||||
keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
|
||||
}
|
||||
|
||||
// Assemble 16 subkeys
|
||||
var subKeys = this._subKeys = [];
|
||||
for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
|
||||
// Create subkey
|
||||
var subKey = subKeys[nSubKey] = [];
|
||||
|
||||
// Shortcut
|
||||
var bitShift = BIT_SHIFTS[nSubKey];
|
||||
|
||||
// Select 48 bits according to PC2
|
||||
for (var i = 0; i < 24; i++) {
|
||||
// Select from the left 28 key bits
|
||||
subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
|
||||
|
||||
// Select from the right 28 key bits
|
||||
subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
|
||||
}
|
||||
|
||||
// Since each subkey is applied to an expanded 32-bit input,
|
||||
// the subkey can be broken into 8 values scaled to 32-bits,
|
||||
// which allows the key to be used without expansion
|
||||
subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
|
||||
for (var i = 1; i < 7; i++) {
|
||||
subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
|
||||
}
|
||||
subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
|
||||
}
|
||||
|
||||
// Compute inverse subkeys
|
||||
var invSubKeys = this._invSubKeys = [];
|
||||
for (var i = 0; i < 16; i++) {
|
||||
invSubKeys[i] = subKeys[15 - i];
|
||||
}
|
||||
},
|
||||
|
||||
encryptBlock: function (M, offset) {
|
||||
this._doCryptBlock(M, offset, this._subKeys);
|
||||
},
|
||||
|
||||
decryptBlock: function (M, offset) {
|
||||
this._doCryptBlock(M, offset, this._invSubKeys);
|
||||
},
|
||||
|
||||
_doCryptBlock: function (M, offset, subKeys) {
|
||||
// Get input
|
||||
this._lBlock = M[offset];
|
||||
this._rBlock = M[offset + 1];
|
||||
|
||||
// Initial permutation
|
||||
exchangeLR.call(this, 4, 0x0f0f0f0f);
|
||||
exchangeLR.call(this, 16, 0x0000ffff);
|
||||
exchangeRL.call(this, 2, 0x33333333);
|
||||
exchangeRL.call(this, 8, 0x00ff00ff);
|
||||
exchangeLR.call(this, 1, 0x55555555);
|
||||
|
||||
// Rounds
|
||||
for (var round = 0; round < 16; round++) {
|
||||
// Shortcuts
|
||||
var subKey = subKeys[round];
|
||||
var lBlock = this._lBlock;
|
||||
var rBlock = this._rBlock;
|
||||
|
||||
// Feistel function
|
||||
var f = 0;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
|
||||
}
|
||||
this._lBlock = rBlock;
|
||||
this._rBlock = lBlock ^ f;
|
||||
}
|
||||
|
||||
// Undo swap from last round
|
||||
var t = this._lBlock;
|
||||
this._lBlock = this._rBlock;
|
||||
this._rBlock = t;
|
||||
|
||||
// Final permutation
|
||||
exchangeLR.call(this, 1, 0x55555555);
|
||||
exchangeRL.call(this, 8, 0x00ff00ff);
|
||||
exchangeRL.call(this, 2, 0x33333333);
|
||||
exchangeLR.call(this, 16, 0x0000ffff);
|
||||
exchangeLR.call(this, 4, 0x0f0f0f0f);
|
||||
|
||||
// Set output
|
||||
M[offset] = this._lBlock;
|
||||
M[offset + 1] = this._rBlock;
|
||||
},
|
||||
|
||||
keySize: 64/32,
|
||||
|
||||
ivSize: 64/32,
|
||||
|
||||
blockSize: 64/32
|
||||
});
|
||||
|
||||
// Swap bits across the left and right words
|
||||
function exchangeLR(offset, mask) {
|
||||
var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
|
||||
this._rBlock ^= t;
|
||||
this._lBlock ^= t << offset;
|
||||
}
|
||||
|
||||
function exchangeRL(offset, mask) {
|
||||
var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
|
||||
this._lBlock ^= t;
|
||||
this._rBlock ^= t << offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.DES = BlockCipher._createHelper(DES);
|
||||
|
||||
/**
|
||||
* Triple-DES block cipher algorithm.
|
||||
*/
|
||||
var TripleDES = C_algo.TripleDES = BlockCipher.extend({
|
||||
_doReset: function () {
|
||||
// Shortcuts
|
||||
var key = this._key;
|
||||
var keyWords = key.words;
|
||||
// Make sure the key length is valid (64, 128 or >= 192 bit)
|
||||
if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
|
||||
throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
|
||||
}
|
||||
|
||||
// Extend the key according to the keying options defined in 3DES standard
|
||||
var key1 = keyWords.slice(0, 2);
|
||||
var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
|
||||
var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
|
||||
|
||||
// Create DES instances
|
||||
this._des1 = DES.createEncryptor(WordArray.create(key1));
|
||||
this._des2 = DES.createEncryptor(WordArray.create(key2));
|
||||
this._des3 = DES.createEncryptor(WordArray.create(key3));
|
||||
},
|
||||
|
||||
encryptBlock: function (M, offset) {
|
||||
this._des1.encryptBlock(M, offset);
|
||||
this._des2.decryptBlock(M, offset);
|
||||
this._des3.encryptBlock(M, offset);
|
||||
},
|
||||
|
||||
decryptBlock: function (M, offset) {
|
||||
this._des3.decryptBlock(M, offset);
|
||||
this._des2.encryptBlock(M, offset);
|
||||
this._des1.decryptBlock(M, offset);
|
||||
},
|
||||
|
||||
keySize: 192/32,
|
||||
|
||||
ivSize: 64/32,
|
||||
|
||||
blockSize: 64/32
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.TripleDES = BlockCipher._createHelper(TripleDES);
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var StreamCipher = C_lib.StreamCipher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
/**
|
||||
* RC4 stream cipher algorithm.
|
||||
*/
|
||||
var RC4 = C_algo.RC4 = StreamCipher.extend({
|
||||
_doReset: function () {
|
||||
// Shortcuts
|
||||
var key = this._key;
|
||||
var keyWords = key.words;
|
||||
var keySigBytes = key.sigBytes;
|
||||
|
||||
// Init sbox
|
||||
var S = this._S = [];
|
||||
for (var i = 0; i < 256; i++) {
|
||||
S[i] = i;
|
||||
}
|
||||
|
||||
// Key setup
|
||||
for (var i = 0, j = 0; i < 256; i++) {
|
||||
var keyByteIndex = i % keySigBytes;
|
||||
var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
|
||||
|
||||
j = (j + S[i] + keyByte) % 256;
|
||||
|
||||
// Swap
|
||||
var t = S[i];
|
||||
S[i] = S[j];
|
||||
S[j] = t;
|
||||
}
|
||||
|
||||
// Counters
|
||||
this._i = this._j = 0;
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
M[offset] ^= generateKeystreamWord.call(this);
|
||||
},
|
||||
|
||||
keySize: 256/32,
|
||||
|
||||
ivSize: 0
|
||||
});
|
||||
|
||||
function generateKeystreamWord() {
|
||||
// Shortcuts
|
||||
var S = this._S;
|
||||
var i = this._i;
|
||||
var j = this._j;
|
||||
|
||||
// Generate keystream word
|
||||
var keystreamWord = 0;
|
||||
for (var n = 0; n < 4; n++) {
|
||||
i = (i + 1) % 256;
|
||||
j = (j + S[i]) % 256;
|
||||
|
||||
// Swap
|
||||
var t = S[i];
|
||||
S[i] = S[j];
|
||||
S[j] = t;
|
||||
|
||||
keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
|
||||
}
|
||||
|
||||
// Update counters
|
||||
this._i = i;
|
||||
this._j = j;
|
||||
|
||||
return keystreamWord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.RC4 = StreamCipher._createHelper(RC4);
|
||||
|
||||
/**
|
||||
* Modified RC4 stream cipher algorithm.
|
||||
*/
|
||||
var RC4Drop = C_algo.RC4Drop = RC4.extend({
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @property {number} drop The number of keystream words to drop. Default 192
|
||||
*/
|
||||
cfg: RC4.cfg.extend({
|
||||
drop: 192
|
||||
}),
|
||||
|
||||
_doReset: function () {
|
||||
RC4._doReset.call(this);
|
||||
|
||||
// Drop
|
||||
for (var i = this.cfg.drop; i > 0; i--) {
|
||||
generateKeystreamWord.call(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.RC4Drop = StreamCipher._createHelper(RC4Drop);
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var StreamCipher = C_lib.StreamCipher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Reusable objects
|
||||
var S = [];
|
||||
var C_ = [];
|
||||
var G = [];
|
||||
|
||||
/**
|
||||
* Rabbit stream cipher algorithm
|
||||
*/
|
||||
var Rabbit = C_algo.Rabbit = StreamCipher.extend({
|
||||
_doReset: function () {
|
||||
// Shortcuts
|
||||
var K = this._key.words;
|
||||
var iv = this.cfg.iv;
|
||||
|
||||
// Swap endian
|
||||
for (var i = 0; i < 4; i++) {
|
||||
K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
|
||||
(((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
|
||||
}
|
||||
|
||||
// Generate initial state values
|
||||
var X = this._X = [
|
||||
K[0], (K[3] << 16) | (K[2] >>> 16),
|
||||
K[1], (K[0] << 16) | (K[3] >>> 16),
|
||||
K[2], (K[1] << 16) | (K[0] >>> 16),
|
||||
K[3], (K[2] << 16) | (K[1] >>> 16)
|
||||
];
|
||||
|
||||
// Generate initial counter values
|
||||
var C = this._C = [
|
||||
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
||||
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
||||
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
||||
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
||||
];
|
||||
|
||||
// Carry bit
|
||||
this._b = 0;
|
||||
|
||||
// Iterate the system four times
|
||||
for (var i = 0; i < 4; i++) {
|
||||
nextState.call(this);
|
||||
}
|
||||
|
||||
// Modify the counters
|
||||
for (var i = 0; i < 8; i++) {
|
||||
C[i] ^= X[(i + 4) & 7];
|
||||
}
|
||||
|
||||
// IV setup
|
||||
if (iv) {
|
||||
// Shortcuts
|
||||
var IV = iv.words;
|
||||
var IV_0 = IV[0];
|
||||
var IV_1 = IV[1];
|
||||
|
||||
// Generate four subvectors
|
||||
var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
|
||||
var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
|
||||
var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
|
||||
var i3 = (i2 << 16) | (i0 & 0x0000ffff);
|
||||
|
||||
// Modify counter values
|
||||
C[0] ^= i0;
|
||||
C[1] ^= i1;
|
||||
C[2] ^= i2;
|
||||
C[3] ^= i3;
|
||||
C[4] ^= i0;
|
||||
C[5] ^= i1;
|
||||
C[6] ^= i2;
|
||||
C[7] ^= i3;
|
||||
|
||||
// Iterate the system four times
|
||||
for (var i = 0; i < 4; i++) {
|
||||
nextState.call(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Shortcut
|
||||
var X = this._X;
|
||||
|
||||
// Iterate the system
|
||||
nextState.call(this);
|
||||
|
||||
// Generate four keystream words
|
||||
S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
|
||||
S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
|
||||
S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
|
||||
S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
// Swap endian
|
||||
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
||||
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
||||
|
||||
// Encrypt
|
||||
M[offset + i] ^= S[i];
|
||||
}
|
||||
},
|
||||
|
||||
blockSize: 128/32,
|
||||
|
||||
ivSize: 64/32
|
||||
});
|
||||
|
||||
function nextState() {
|
||||
// Shortcuts
|
||||
var X = this._X;
|
||||
var C = this._C;
|
||||
|
||||
// Save old counter values
|
||||
for (var i = 0; i < 8; i++) {
|
||||
C_[i] = C[i];
|
||||
}
|
||||
|
||||
// Calculate new counter values
|
||||
C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
|
||||
C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
|
||||
C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
|
||||
C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
|
||||
C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
|
||||
C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
|
||||
C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
|
||||
C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
|
||||
this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
|
||||
|
||||
// Calculate the g-values
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var gx = X[i] + C[i];
|
||||
|
||||
// Construct high and low argument for squaring
|
||||
var ga = gx & 0xffff;
|
||||
var gb = gx >>> 16;
|
||||
|
||||
// Calculate high and low result of squaring
|
||||
var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
|
||||
var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
|
||||
|
||||
// High XOR low
|
||||
G[i] = gh ^ gl;
|
||||
}
|
||||
|
||||
// Calculate new state values
|
||||
X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
|
||||
X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
|
||||
X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
|
||||
X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
|
||||
X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
|
||||
X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
|
||||
X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
|
||||
X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.Rabbit = StreamCipher._createHelper(Rabbit);
|
||||
}());
|
||||
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var StreamCipher = C_lib.StreamCipher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
// Reusable objects
|
||||
var S = [];
|
||||
var C_ = [];
|
||||
var G = [];
|
||||
|
||||
/**
|
||||
* Rabbit stream cipher algorithm.
|
||||
*
|
||||
* This is a legacy version that neglected to convert the key to little-endian.
|
||||
* This error doesn't affect the cipher's security,
|
||||
* but it does affect its compatibility with other implementations.
|
||||
*/
|
||||
var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
|
||||
_doReset: function () {
|
||||
// Shortcuts
|
||||
var K = this._key.words;
|
||||
var iv = this.cfg.iv;
|
||||
|
||||
// Generate initial state values
|
||||
var X = this._X = [
|
||||
K[0], (K[3] << 16) | (K[2] >>> 16),
|
||||
K[1], (K[0] << 16) | (K[3] >>> 16),
|
||||
K[2], (K[1] << 16) | (K[0] >>> 16),
|
||||
K[3], (K[2] << 16) | (K[1] >>> 16)
|
||||
];
|
||||
|
||||
// Generate initial counter values
|
||||
var C = this._C = [
|
||||
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
||||
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
||||
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
||||
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
||||
];
|
||||
|
||||
// Carry bit
|
||||
this._b = 0;
|
||||
|
||||
// Iterate the system four times
|
||||
for (var i = 0; i < 4; i++) {
|
||||
nextState.call(this);
|
||||
}
|
||||
|
||||
// Modify the counters
|
||||
for (var i = 0; i < 8; i++) {
|
||||
C[i] ^= X[(i + 4) & 7];
|
||||
}
|
||||
|
||||
// IV setup
|
||||
if (iv) {
|
||||
// Shortcuts
|
||||
var IV = iv.words;
|
||||
var IV_0 = IV[0];
|
||||
var IV_1 = IV[1];
|
||||
|
||||
// Generate four subvectors
|
||||
var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
|
||||
var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
|
||||
var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
|
||||
var i3 = (i2 << 16) | (i0 & 0x0000ffff);
|
||||
|
||||
// Modify counter values
|
||||
C[0] ^= i0;
|
||||
C[1] ^= i1;
|
||||
C[2] ^= i2;
|
||||
C[3] ^= i3;
|
||||
C[4] ^= i0;
|
||||
C[5] ^= i1;
|
||||
C[6] ^= i2;
|
||||
C[7] ^= i3;
|
||||
|
||||
// Iterate the system four times
|
||||
for (var i = 0; i < 4; i++) {
|
||||
nextState.call(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_doProcessBlock: function (M, offset) {
|
||||
// Shortcut
|
||||
var X = this._X;
|
||||
|
||||
// Iterate the system
|
||||
nextState.call(this);
|
||||
|
||||
// Generate four keystream words
|
||||
S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
|
||||
S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
|
||||
S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
|
||||
S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
// Swap endian
|
||||
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
||||
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
||||
|
||||
// Encrypt
|
||||
M[offset + i] ^= S[i];
|
||||
}
|
||||
},
|
||||
|
||||
blockSize: 128/32,
|
||||
|
||||
ivSize: 64/32
|
||||
});
|
||||
|
||||
function nextState() {
|
||||
// Shortcuts
|
||||
var X = this._X;
|
||||
var C = this._C;
|
||||
|
||||
// Save old counter values
|
||||
for (var i = 0; i < 8; i++) {
|
||||
C_[i] = C[i];
|
||||
}
|
||||
|
||||
// Calculate new counter values
|
||||
C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
|
||||
C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
|
||||
C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
|
||||
C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
|
||||
C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
|
||||
C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
|
||||
C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
|
||||
C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
|
||||
this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
|
||||
|
||||
// Calculate the g-values
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var gx = X[i] + C[i];
|
||||
|
||||
// Construct high and low argument for squaring
|
||||
var ga = gx & 0xffff;
|
||||
var gb = gx >>> 16;
|
||||
|
||||
// Calculate high and low result of squaring
|
||||
var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
|
||||
var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
|
||||
|
||||
// High XOR low
|
||||
G[i] = gh ^ gl;
|
||||
}
|
||||
|
||||
// Calculate new state values
|
||||
X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
|
||||
X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
|
||||
X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
|
||||
X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
|
||||
X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
|
||||
X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
|
||||
X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
|
||||
X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS;
|
||||
|
||||
}));
|
||||
@@ -0,0 +1 @@
|
||||
**dmFyIGxpc3RzID0gYGpzOgpsb2coVEFCUyk7CmxldCBkID0gW107CnBkZmggPSBqc3AucGRmaDsKcGRmYSA9IGpzcC5wZGZhOwppZiAodHlwZW9mIHBsYXlfdXJsID09PSAidW5kZWZpbmVkIikgewoJdmFyIHBsYXlfdXJsID0gIiIKfQoKZnVuY3Rpb24gZ2V0TGlzdHMoaHRtbCkgewoJbGV0IHNyYyA9IHBkZmgoaHRtbCwgIi53cC1wbGF5bGlzdC1zY3JpcHQmJkh0bWwiKTsKCXNyYyA9IEpTT04ucGFyc2Uoc3JjKS50cmFja3M7CglsZXQgbGlzdDEgPSBbXTsKCWxldCBsaXN0MiA9IFtdOwoJbGV0IHVybDEgPSAiIjsKCWxldCB1cmwyID0gIiI7CglzcmMuZm9yRWFjaChmdW5jdGlvbihpdCkgewoJCWxldCBzcmMwID0gaXQuc3JjMDsKCQlsZXQgc3JjMSA9IGl0LnNyYzE7CgkJbGV0IHRpdGxlID0gaXQuY2FwdGlvbjsKCQl1cmwxID0gImh0dHBzOi8vdi5kZHlzLnBybyIgKyBzcmMwOwoJCXVybDIgPSAiaHR0cHM6Ly9kZHlzLnByby9nZXR2ZGRyMi92aWRlbz9pZD0iICsgc3JjMSArICImdHlwZT1taXgiOwoJCWxldCB6bSA9ICJodHRwczovL2RkeXMucHJvL3N1YmRkci8iICsgaXQuc3Vic3JjOwoJCWxpc3QxLnB1c2goewoJCQl0aXRsZTogdGl0bGUsCgkJCXVybDogdXJsMSwKCQkJZGVzYzogem0KCQl9KTsKCQlsaXN0Mi5wdXNoKHsKCQkJdGl0bGU6IHRpdGxlLAoJCQl1cmw6IHVybDIsCgkJCWRlc2M6IHptCgkJfSkKCX0pOwoJcmV0dXJuIHsKCQlsaXN0MTogbGlzdDEsCgkJbGlzdDI6IGxpc3QyCgl9Cn0KdmFyIGRhdGEgPSBnZXRMaXN0cyhodG1sKTsKdmFyIGxpc3QxID0gZGF0YS5saXN0MTsKdmFyIGxpc3QyID0gZGF0YS5saXN0MjsKbGV0IG51bXMgPSBwZGZhKGh0bWwsICJib2R5JiYucG9zdC1wYWdlLW51bWJlcnMiKTsKbnVtcy5mb3JFYWNoKGZ1bmN0aW9uKGl0KSB7CglsZXQgbnVtID0gcGRmaChpdCwgImJvZHkmJlRleHQiKTsKCWxvZyhudW0pOwoJbGV0IG51cmwgPSBpbnB1dCArIG51bSArICIvIjsKCWlmIChudW0gPT0gMSkgewoJCXJldHVybgoJfQoJbG9nKG51cmwpOwoJbGV0IGh0bWwgPSByZXF1ZXN0KG51cmwpOwoJbGV0IGRhdGEgPSBnZXRMaXN0cyhodG1sKTsKCWxpc3QxID0gbGlzdDEuY29uY2F0KGRhdGEubGlzdDEpOwoJbGlzdDIgPSBsaXN0Mi5jb25jYXQoZGF0YS5saXN0MikKfSk7Cmxpc3QxID0gbGlzdDEubWFwKGZ1bmN0aW9uKGl0ZW0pIHsKCXJldHVybiBpdGVtLnRpdGxlICsgIiQiICsgcGxheV91cmwgKyB1cmxlbmNvZGUoaXRlbS51cmwgKyAifCIgKyBpbnB1dCArICJ8IiArIGl0ZW0uZGVzYykKfSk7Cmxpc3QyID0gbGlzdDIubWFwKGZ1bmN0aW9uKGl0ZW0pIHsKCXJldHVybiBpdGVtLnRpdGxlICsgIiQiICsgcGxheV91cmwgKyB1cmxlbmNvZGUoaXRlbS51cmwgKyAifCIgKyBpbnB1dCArICJ8IiArIGl0ZW0uZGVzYykKfSk7CkxJU1RTID0gW2xpc3QxLCBsaXN0Ml07CmA7Cgp2YXIgbGF6eSA9IGBqczoKbGV0IHB1cmwgPSBpbnB1dC5zcGxpdCgifCIpWzBdOwpsZXQgcmVmZXJlciA9IGlucHV0LnNwbGl0KCJ8IilbMV07CmxldCB6bSA9IGlucHV0LnNwbGl0KCJ8IilbMl07CnByaW50KCJwdXJsOiIgKyBwdXJsKTsKcHJpbnQoInJlZmVyZXI6IiArIHJlZmVyZXIpOwpwcmludCgiem06IiArIHptKTsKaWYgKC9nZXR2ZGRyLy50ZXN0KHB1cmwpKSB7CiAgICBsZXQgaHRtbCA9IHJlcXVlc3QocHVybCwgewogICAgICAgIGhlYWRlcnM6IHsKICAgICAgICAgICAgUmVmZXJlcjogSE9TVCwKICAgICAgICAgICAgIlVzZXItQWdlbnQiOiBNT0JJTEVfVUEKICAgICAgICB9CiAgICB9KTsKICAgIHByaW50KGh0bWwpOwogICAgdHJ5IHsKICAgICAgICBpbnB1dCA9IHtqeDowLHVybDpKU09OLnBhcnNlKGh0bWwpLnVybCxwYXJzZTowfSB8fCB7fQogICAgfSBjYXRjaCAoZSkgewogICAgICAgIGlucHV0ID0gcHVybAogICAgfQp9IGVsc2UgewogICAgaW5wdXQgPSB7CiAgICAgICAgang6IDAsCiAgICAgICAgdXJsOiBwdXJsLAogICAgICAgIHBhcnNlOiAwLAogICAgICAgIGhlYWRlcjogSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICAndXNlci1hZ2VudCc6IE1PQklMRV9VQSwKICAgICAgICAgICAgJ3JlZmVyZXInOiBIT1NUCiAgICAgICAgfSkKICAgIH0KfQpgOwoKLy8g572R5Z2A5Y+R5biD6aG1IGh0dHBzOi8vZGR5cy5zaXRlCi8vIOe9keWdgOWPkeW4g+mhtSBodHRwczovL2RkeXMud2lraQp2YXIgcnVsZT17CiAgICB0aXRsZTonZGR5cycsCiAgICAvLyBob3N0OidodHRwczovL2RkeXMud2lraScsIAogICAgLy8gaG9zdEpzOidwcmludChIT1NUKTtsZXQgaHRtbD1yZXF1ZXN0KEhPU1Qse2hlYWRlcnM6eyJVc2VyLUFnZW50IjpNT0JJTEVfVUF9fSk7SE9TVCA9IGpzcC5wZGZoKGh0bWwsImE6ZXEoMSkmJmhyZWYiKScsCiAgICBob3N0OidodHRwczovL2RkeXMucHJvJywKICAgIC8vIGhvc3Q6J2h0dHBzOi8vZGR5cy5tb3YnLAogICAgdXJsOicvZnljbGFzcy9wYWdlL2Z5cGFnZS8nLAogICAgc2VhcmNoVXJsOicvP3M9KiomcG9zdF90eXBlPXBvc3QnLAogICAgc2VhcmNoYWJsZToyLAogICAgcXVpY2tTZWFyY2g6MCwKICAgIGZpbHRlcmFibGU6MCwKICAgIGhlYWRlcnM6ewogICAgICAgICdVc2VyLUFnZW50JzonTU9CSUxFX1VBJywKICAgIH0sCiAgICBjbGFzc19wYXJzZTonI3ByaW1hcnktbWVudSBsaS5tZW51LWl0ZW07YSYmVGV4dDthJiZocmVmO1wucHJvLyguKiknLAogICAgY2F0ZV9leGNsdWRlOifnq5nplb98XuWFtuS7liR85YWz5LqOfF7nlLXlvbEkfF7liafpm4YkfF7nsbvlnoskJywKICAgIHBsYXlfcGFyc2U6dHJ1ZSwKICAgIC8vIGxhenk6J2pzOmxldCBwdXJsPWlucHV0LnNwbGl0KCJ8IilbMF07bGV0IHJlZmVyZXI9aW5wdXQuc3BsaXQoInwiKVsxXTtsZXQgem09aW5wdXQuc3BsaXQoInwiKVsyXTtwcmludCgicHVybDoiK3B1cmwpO3ByaW50KCJyZWZlcmVyOiIrcmVmZXJlcik7cHJpbnQoInptOiIrem0pO2xldCBteXVhPSJva2h0dHAvMy4xNSI7aWYoL2RkcmtleS8udGVzdChwdXJsKSl7bGV0IHJldD1yZXF1ZXN0KHB1cmwse1JlZmVyZXI6cmVmZXJlcix3aXRoSGVhZGVyczp0cnVlLCJVc2VyLUFnZW50IjpteXVhfSk7bG9nKHJldCk7aW5wdXQ9cHVybH1lbHNle2xldCBodG1sPXJlcXVlc3QocHVybCx7aGVhZGVyczp7UmVmZXJlcjpyZWZlcmVyLCJVc2VyLUFnZW50IjpteXVhfX0pO3ByaW50KGh0bWwpO3RyeXtpbnB1dD1KU09OLnBhcnNlKGh0bWwpLnVybHx8e319Y2F0Y2goZSl7aW5wdXQ9cHVybH19JywKICAgIGxhenk6bGF6eSwKICAgIGxpbWl0OjYsCiAgICDmjqjojZA6JyonLAogICAgZG91YmxlOnRydWUsIC8vIOaOqOiNkOWGheWuueaYr+WQpuWPjOWxguWumuS9jQogICAg5LiA57qnOicucG9zdC1ib3gtbGlzdCYmYXJ0aWNsZTthOmVxKC0xKSYmVGV4dDsucG9zdC1ib3gtaW1hZ2UmJnN0eWxlO2E6ZXEoMCkmJlRleHQ7YTplcSgtMSkmJmhyZWYnLAogICAg5LqM57qnOnsKICAgICAgICAidGl0bGUiOiIucG9zdC10aXRsZSYmVGV4dDsuY2F0LWxpbmtzJiZUZXh0IiwKICAgICAgICAiaW1nIjoiLmRvdWxpc3QtaXRlbSYmaW1nJiZkYXRhLWNmc3JjIiwKICAgICAgICAiZGVzYyI6Ii5wdWJsaXNoZWQmJlRleHQiLAogICAgICAgICJjb250ZW50IjoiLmFic3RyYWN0JiZUZXh0IiwKICAgICAgICAvLyAidGFicyI6ImpzOlRBQlM9Wyflm73lhoUnLCfmtbflpJYo6LKM5Ly85LiN6IO95pKt5pS+KSddIiwKICAgICAgICAidGFicyI6ImpzOlRBQlM9Wyflm73lhoUo5pS5RXhv5pKt5pS+5ZmoKScsJ+WbveWGhTInXSIsCiAgICAgICAgLy8gImxpc3RzIjoianM6bG9nKFRBQlMpO2xldCBkPVtdO3BkZmg9anNwLnBkZmg7cGRmYT1qc3AucGRmYTtpZih0eXBlb2YgcGxheV91cmw9PT1cInVuZGVmaW5lZFwiKXt2YXIgcGxheV91cmw9XCJcIn1mdW5jdGlvbiBnZXRMaXN0cyhodG1sKXtsZXQgc3JjPXBkZmgoaHRtbCxcIi53cC1wbGF5bGlzdC1zY3JpcHQmJkh0bWxcIik7c3JjPUpTT04ucGFyc2Uoc3JjKS50cmFja3M7bGV0IGxpc3QxPVtdO2xldCBsaXN0Mj1bXTtzcmMuZm9yRWFjaChmdW5jdGlvbihpdCl7bGV0IHNyYzA9aXQuc3JjMDtsZXQgc3JjMT1pdC5zcmMxO2xldCBzcmMyPWl0LnNyYzI7bGV0IHRpdGxlPWl0LmNhcHRpb247bGV0IHVybDE9XCJodHRwczovL2RkeXMudHYvZ2V0dmRkci92aWRlbz9pZD1cIitzcmMxK1wiJmRpbT0xMDgwUCsmdHlwZT1taXhcIjtsZXQgdXJsMj1cImh0dHBzOi8vdy5kZHlzLnR2XCIrc3JjMCtcIj9kZHJrZXk9XCIrc3JjMjtsZXQgem09XCJodHRwczovL2RkeXMudHYvc3ViZGRyL1wiK2l0LnN1YnNyYztsaXN0MS5wdXNoKHt0aXRsZTp0aXRsZSx1cmw6dXJsMSxkZXNjOnptfSk7bGlzdDIucHVzaCh7dGl0bGU6dGl0bGUsdXJsOnVybDIsZGVzYzp6bX0pfSk7cmV0dXJue2xpc3QxOmxpc3QxLGxpc3QyOmxpc3QyfX12YXIgZGF0YT1nZXRMaXN0cyhodG1sKTt2YXIgbGlzdDE9ZGF0YS5saXN0MTt2YXIgbGlzdDI9ZGF0YS5saXN0MjtsZXQgbnVtcz1wZGZhKGh0bWwsXCJib2R5JiYucG9zdC1wYWdlLW51bWJlcnNcIik7bnVtcy5mb3JFYWNoKGZ1bmN0aW9uKGl0KXtsZXQgbnVtPXBkZmgoaXQsXCJib2R5JiZUZXh0XCIpO2xvZyhudW0pO2xldCBudXJsPWlucHV0K251bStcIi9cIjtpZihudW09PTEpe3JldHVybn1sb2cobnVybCk7bGV0IGh0bWw9cmVxdWVzdChudXJsKTtsZXQgZGF0YT1nZXRMaXN0cyhodG1sKTtsaXN0MT1saXN0MS5jb25jYXQoZGF0YS5saXN0MSk7bGlzdDI9bGlzdDIuY29uY2F0KGRhdGEubGlzdDIpfSk7bGlzdDE9bGlzdDEubWFwKGZ1bmN0aW9uKGl0ZW0pe3JldHVybiBpdGVtLnRpdGxlK1wiJFwiK3BsYXlfdXJsK3VybGVuY29kZShpdGVtLnVybCtcInxcIitpbnB1dCtcInxcIitpdGVtLmRlc2MpfSk7bGlzdDI9bGlzdDIubWFwKGZ1bmN0aW9uKGl0ZW0pe3JldHVybiBpdGVtLnRpdGxlK1wiJFwiK3BsYXlfdXJsK3VybGVuY29kZShpdGVtLnVybCtcInxcIitpbnB1dCtcInxcIitpdGVtLmRlc2MpfSk7TElTVFM9W2xpc3QxLGxpc3QyXTsiLAogICAgICAgIC8vIGxpc3RzOidqczpsb2coVEFCUyk7bGV0IGQ9W107cGRmaD1qc3AucGRmaDtwZGZhPWpzcC5wZGZhO2lmKHR5cGVvZiBwbGF5X3VybD09PSJ1bmRlZmluZWQiKXt2YXIgcGxheV91cmw9IiJ9ZnVuY3Rpb24gZ2V0TGlzdHMoaHRtbCl7bGV0IHNyYz1wZGZoKGh0bWwsIi53cC1wbGF5bGlzdC1zY3JpcHQmJkh0bWwiKTtzcmM9SlNPTi5wYXJzZShzcmMpLnRyYWNrcztsZXQgbGlzdDE9W107bGV0IGxpc3QyPVtdO3NyYy5mb3JFYWNoKGZ1bmN0aW9uKGl0KXtsZXQgc3JjMD1pdC5zcmMwO2xldCBzcmMxPWl0LnNyYzE7bGV0IHNyYzI9aXQuc3JjMjtsZXQgdGl0bGU9aXQuY2FwdGlvbjtsZXQgdXJsMT0iaHR0cHM6Ly9kZHlzLnByby9nZXR2ZGRyL3ZpZGVvP2lkPSIrc3JjMSsiJmRpbT0xMDgwUCsmdHlwZT1taXgiO2xldCB1cmwyPSJodHRwczovL3cuZGR5cy5wcm8iK3NyYzArIj9kZHJrZXk9IitzcmMyO2xldCB6bT0iaHR0cHM6Ly9kZHlzLnByby9zdWJkZHIvIitpdC5zdWJzcmM7bGlzdDEucHVzaCh7dGl0bGU6dGl0bGUsdXJsOnVybDEsZGVzYzp6bX0pO2xpc3QyLnB1c2goe3RpdGxlOnRpdGxlLHVybDp1cmwyLGRlc2M6em19KX0pO3JldHVybntsaXN0MTpsaXN0MSxsaXN0MjpsaXN0Mn19dmFyIGRhdGE9Z2V0TGlzdHMoaHRtbCk7dmFyIGxpc3QxPWRhdGEubGlzdDE7dmFyIGxpc3QyPWRhdGEubGlzdDI7bGV0IG51bXM9cGRmYShodG1sLCJib2R5JiYucG9zdC1wYWdlLW51bWJlcnMiKTtudW1zLmZvckVhY2goZnVuY3Rpb24oaXQpe2xldCBudW09cGRmaChpdCwiYm9keSYmVGV4dCIpO2xvZyhudW0pO2xldCBudXJsPWlucHV0K251bSsiLyI7aWYobnVtPT0xKXtyZXR1cm59bG9nKG51cmwpO2xldCBodG1sPXJlcXVlc3QobnVybCk7bGV0IGRhdGE9Z2V0TGlzdHMoaHRtbCk7bGlzdDE9bGlzdDEuY29uY2F0KGRhdGEubGlzdDEpO2xpc3QyPWxpc3QyLmNvbmNhdChkYXRhLmxpc3QyKX0pO2xpc3QxPWxpc3QxLm1hcChmdW5jdGlvbihpdGVtKXtyZXR1cm4gaXRlbS50aXRsZSsiJCIrcGxheV91cmwrdXJsZW5jb2RlKGl0ZW0udXJsKyJ8IitpbnB1dCsifCIraXRlbS5kZXNjKX0pO2xpc3QyPWxpc3QyLm1hcChmdW5jdGlvbihpdGVtKXtyZXR1cm4gaXRlbS50aXRsZSsiJCIrcGxheV91cmwrdXJsZW5jb2RlKGl0ZW0udXJsKyJ8IitpbnB1dCsifCIraXRlbS5kZXNjKX0pO0xJU1RTPVtsaXN0MSxsaXN0Ml07JywKICAgICAgICAibGlzdHMiOmxpc3RzCiAgICB9LAogICAg5pCc57SiOicjbWFpbiYmYXJ0aWNsZTsucG9zdC10aXRsZSYmVGV4dDs7LnB1Ymxpc2hlZCYmVGV4dDthJiZocmVmJwp9
|
||||
@@ -0,0 +1 @@
|
||||
import cheerio from"assets://js/lib/cheerio.min.js";import"assets://js/lib/crypto-js.js";import 模板 from"https://fs-im-kefu.7moor-fs1.com/ly/4d2c3f00-7d4c-11e5-af15-41bf63ae4ea0/1720319227738/%E6%A8%A1%E6%9D%BF.txt";import{gbkTool}from"https://fs-im-kefu.7moor-fs1.com/ly/4d2c3f00-7d4c-11e5-af15-41bf63ae4ea0/1720319220141/gbk.txt";function init_test(){console.log("init_test_start"),console.log("当前版本号:"+VERSION),console.log(RKEY),console.log(JSON.stringify(rule)),console.log("init_test_end")}function pre(){if("string"==typeof rule.预处理&&rule.预处理&&rule.预处理.trim()){let code=rule.预处理.trim();console.log("执行预处理代码:"+code),code.startsWith("js:")&&(code=code.replace("js:",""));try{eval(code)}catch(e){console.log("预处理执行失败:"+e.message)}}}let rule={},vercode="function"==typeof pdfl?"drpy2.1":"drpy2";const VERSION=vercode+" 3.9.49beta2 20231122",MOBILE_UA="Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36",PC_UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36",UA="Mozilla/5.0",UC_UA="Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36",IOS_UA="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",RULE_CK="cookie",CATE_EXCLUDE="首页|留言|APP|下载|资讯|新闻|动态",TAB_EXCLUDE="猜你|喜欢|下载|剧情|热播",OCR_RETRY=3,OCR_API="http://drpy.nokia.press:8028/ocr/drpy/text";if(void 0===MY_URL)var MY_URL;var HOST,RKEY,fetch,print,log,rule_fetch_params,fetch_params,oheaders,_pdfh,_pdfa,_pd;const DOM_CHECK_ATTR=/(url|src|href|-original|-src|-play|-url|style)$/,SPECIAL_URL=/^(ftp|magnet|thunder|ws):/,NOADD_INDEX=/:eq|:lt|:gt|:first|:last|^body$|^#/,URLJOIN_ATTR=/(url|src|href|-original|-src|-play|-url|style)$/,SELECT_REGEX=/:eq|:lt|:gt|#/g,SELECT_REGEX_A=/:eq|:lt|:gt/g;function 是否正版(e){return new RegExp("qq.com|iqiyi.com|youku.com|mgtv.com|bilibili.com|sohu.com|ixigua.com|pptv.com|miguvideo.com|le.com|1905.com|fun.tv").test(e)}function urlDeal(e){return e?是否正版(e)?(/miguvideo/.test(e)||(e=e.split("#")[0].split("?")[0]),e):e:""}function setResult(e){return Array.isArray(e)?(VODS=[],e.forEach(function(e){let t={vod_id:e.url||"",vod_name:e.title||"",vod_remarks:e.desc||"",vod_content:e.content||"",vod_pic:e.pic_url||e.img||""},r=Object.keys(e);r.includes("tname")&&(t.type_name=e.tname||""),r.includes("tid")&&(t.type_id=e.tid||""),r.includes("year")&&(t.vod_year=e.year||""),r.includes("actor")&&(t.vod_actor=e.actor||""),r.includes("director")&&(t.vod_director=e.director||""),r.includes("area")&&(t.vod_area=e.area||""),VODS.push(t)}),VODS):[]}function setResult2(e){return VODS=e.list||[]}function setHomeResult(e){return e&&"object"==typeof e?setResult(e.list):[]}function rc(e){if("maomi_aes.js"===e){var t=CryptoJS.enc.Utf8.parse("625222f9149e961d"),r=CryptoJS.enc.Utf8.parse("5efdtf6060e2o330");return{De:function(e){return e=CryptoJS.enc.Hex.parse(e),CryptoJS.AES.decrypt(CryptoJS.enc.Base64.stringify(e),t,{iv:r,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)},En:function(e){return CryptoJS.AES.encrypt(e,t,{iv:r,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.Pkcs7}).ciphertext.toString()}}}return{}}function maoss(jxurl,ref,key){fetch_params=JSON.parse(JSON.stringify(rule_fetch_params)),eval(getCryptoJS());try{var getVideoInfo=function(e){return CryptoJS.AES.decrypt(e,key,{iv:iv,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)},token_key=null==key?"dvyYRQlnPRCMdQSe":key;if(ref)var html=request(jxurl,{headers:{Referer:ref}});else var html=request(jxurl);-1!=html.indexOf("&btwaf=")&&(html=request(jxurl+"&btwaf"+html.match(/&btwaf(.*?)"/)[1],{headers:{Referer:ref}}));var token_iv=html.split('_token = "')[1].split('"')[0],key=CryptoJS.enc.Utf8.parse(token_key),iv=CryptoJS.enc.Utf8.parse(token_iv);return eval(html.match(/var config = {[\s\S]*?}/)[0]+""),config.url.startsWith("http")||(config.url=CryptoJS.AES.decrypt(config.url,key,{iv:iv,padding:CryptoJS.pad.Pkcs7}).toString(CryptoJS.enc.Utf8)),config.url}catch(e){return""}}function urlencode(e){return e=(e+"").toString(),encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/%20/g,"+")}function base64Encode(e){return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(e))}function base64Decode(e){return CryptoJS.enc.Utf8.stringify(CryptoJS.enc.Base64.parse(e))}function md5(e){return CryptoJS.MD5(e).toString()}function encodeStr(e,t){if((t=t||"gbk").startsWith("gb")){e=gbkTool().encode(e)}return e}function decodeStr(e,t){if((t=t||"gbk").startsWith("gb")){e=gbkTool().decode(e)}return e}function getCryptoJS(){return'console.log("CryptoJS已装载");'}"function"!=typeof Object.assign&&(Object.assign=function(){for(var e=arguments[0],t=1;t<arguments.length;t++){var r=arguments[t];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e}),String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),l=r.length>>>0;if(0===l)return!1;for(var o=0|t,s=Math.max(o>=0?o:l-Math.abs(o),0);s<l;){if(r[s]===e)return!0;s++}return!1}}),"function"!=typeof String.prototype.startsWith&&(String.prototype.startsWith=function(e){return this.slice(0,e.length)===e}),"function"!=typeof String.prototype.endsWith&&(String.prototype.endsWith=function(e){return-1!==this.indexOf(e,this.length-e.length)}),Object.prototype.myValues=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t},"function"!=typeof Object.prototype.values&&(Object.prototype.values=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}),"function"!=typeof Array.prototype.join&&(Array.prototype.join=function(e){e=e||"";let t=this,r="",l=0;if(!Array.isArray(t))throw String(t)+"is not Array";if(0===t.length)return"";if(1===t.length)return String(t[0]);for(l=1,r=this[0];l<t.length;l++)r+=String(e)+String(t[l]);return r}),String.prototype.rstrip=function(e){let t=new RegExp(e+"$");return this.replace(t,"")},Array.prototype.append=Array.prototype.push,String.prototype.strip=String.prototype.trim;const RSA={encode:function(e,t,r){return"function"==typeof rsaEncrypt&&(r&&"object"==typeof r?rsaEncrypt(e,t,r):rsaEncrypt(e,t))},decode:function(e,t,r){return"function"==typeof rsaDecrypt&&(r&&"object"==typeof r?rsaDecrypt(e,t,r):rsaDecrypt(e,t))}};function getProxyUrl(){return"function"==typeof getProxy?getProxy(!0):"http://127.0.0.1:9978/proxy?do=js"}function forceOrder(e,t,r){let l=Math.floor(e.length/2),o=Math.min(e.length-1,l+1);if(l>=o)return e;let s=e[l],a=e[o];if(t)try{s=s[t],a=a[t]}catch(e){}if(r&&"function"==typeof r)try{s=r(s),a=r(a)}catch(e){}if(a+="",(s+="").match(/(\d+)/)&&a.match(/(\d+)/)){Number(s.match(/(\d+)/)[1])>Number(a.match(/(\d+)/)[1])&&e.reverse()}return e}let VODS=[],VOD={},TABS=[],LISTS=[];function urljoin(e,t){return e=e||"",t=t||"",joinUrl(e,t)}globalThis.encodeUrl=urlencode,globalThis.urlencode=urlencode;var urljoin2=urljoin;const defaultParser={pdfh:pdfh,pdfa:pdfa,pd:pd};function pdfh2(e,t){let r=e;try{"string"!=typeof e&&(r=e.rr(e.ele).toString())}catch(e){print("html对象转文本发生了错误:"+e.message)}let l=defaultParser.pdfh(r,t),o=t.includes("&&")?t.split("&&").slice(-1)[0]:t.split(" ").slice(-1)[0];if(/style/.test(o.toLowerCase())&&/url\(/.test(l))try{l=(l=l.match(/url\((.*?)\)/)[1]).replace(/^['|"](.*)['|"]$/,"$1")}catch(e){}return l}function pdfa2(e,t){let r=e;try{"string"!=typeof e&&(r=e.rr(e.ele).toString())}catch(e){print("html对象转文本发生了错误:"+e.message)}return defaultParser.pdfa(r,t)}function pd2(e,t,r){let l=pdfh2(e,t);return void 0!==r&&r||(r=""),DOM_CHECK_ATTR.test(t)&&!SPECIAL_URL.test(l)&&(l=/http/.test(l)?l.substr(l.indexOf("http")):urljoin(MY_URL,l)),l}const parseTags={jsp:{pdfh:pdfh2,pdfa:pdfa2,pd:pd2},json:{pdfh(e,t){if(!t||!t.trim())return"";"string"==typeof e&&(e=JSON.parse(e)),(t=t.trim()).startsWith("$.")||(t="$."+t),t=t.split("||");for(let r of t){let t=cheerio.jp(r,e);if((t=Array.isArray(t)?t[0]||"":t||"")&&"string"!=typeof t&&(t=t.toString()),t)return t}return""},pdfa(e,t){if(!t||!t.trim())return"";"string"==typeof e&&(e=JSON.parse(e)),(t=t.trim()).startsWith("$.")||(t="$."+t);let r=cheerio.jp(t,e);return Array.isArray(r)&&Array.isArray(r[0])&&1===r.length?r[0]||[]:r||[]},pd(e,t){let r=parseTags.json.pdfh(e,t);return r?urljoin(MY_URL,r):r}},jq:{pdfh(e,t){if(!e||!t||!t.trim())return"";return t=t.trim(),defaultParser.pdfh(e,t)},pdfa(e,t){if(!e||!t||!t.trim())return[];t=t.trim();let r=defaultParser.pdfa(e,t);return print(`pdfa解析${t}=>${r.length}`),r},pd:(e,t,r)=>e&&t&&t.trim()?(t=t.trim(),r=r||MY_URL,defaultParser.pd(e,t,r)):""},getParse(e){return e.startsWith("jsp:")?this.jsp:e.startsWith("json:")?this.json:(e.startsWith("jq:"),this.jq)}},stringify=JSON.stringify,jsp=parseTags.jsp,jq=parseTags.jq;function readFile(e){e=e||"./uri.min.js";var t=os.open(e),r=new ArrayBuffer(1024),l=os.read(t,r,0,1024);console.log(l);let o=String.fromCharCode.apply(null,new Uint8Array(r));return console.log(o),o}function dealJson(e){try{(e=e.trim()).startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")||(e="{"+e.match(/.*?\{(.*)\}/m)[1]+"}")}catch(e){}try{e=JSON.parse(e)}catch(e){}return e}var OcrApi={api:OCR_API,classification:function(e){let t="";try{log("通过drpy_ocr验证码接口过验证..."),t=request(OCR_API,{data:{img:e},headers:{"User-Agent":PC_UA},method:"POST"},!0)||""}catch(e){log(`OCR识别验证码发生错误:${e.message}`)}return t}};function verifyCode(e){let t=0,r=getHome(e),l="";for(;t<OCR_RETRY;){try{let e=`${r}/index.php/verify/index.html`;console.log(`验证码链接:${e}`);let o=request(e,{withHeaders:!0,toBase64:!0},!0),s=JSON.parse(o);if(!l){let e=Object.keys(s).find(e=>"set-cookie"===e.toLowerCase());l=e?s[e].split(";")[0]:""}console.log("cookie:"+l);let a=s.body,i=OcrApi.classification(a);console.log(`第${t+1}次验证码识别结果:${i}`);let n=`${r}/index.php/ajax/verify_check?type=search&verify=${i}`;console.log(n);let p=request(n,{headers:{Cookie:l,"User-Agent":MOBILE_UA},method:"POST"});if("ok"===(p=JSON.parse(p)).msg)return console.log(`第${t+1}次验证码提交成功`),l;"ok"!==p.msg&&t+1>=OCR_RETRY&&(l="")}catch(e){console.log(`第${t+1}次验证码提交失败:${e.message}`),t+1>=OCR_RETRY&&(l="")}t+=1}return l}function setItem(e,t){local.set(RKEY,e,t),console.log(`规则${RKEY}设置${e} => ${t}`)}function getItem(e,t){return local.get(RKEY,e)||t}function clearItem(e){local.delete(RKEY,e)}function getHome(e){if(!e)return"";let t=e.split("//");e=t[0]+"//"+t[1].split("/")[0];try{e=decodeURIComponent(e)}catch(e){}return e}function buildUrl(e,t){t=t||{},e.indexOf("?")<0&&(e+="?");let r=[],l=Object.keys(t);l.forEach(e=>{r.push(e+"="+t[e])});let o=r.join("&");return l.length>0&&!e.endsWith("?")&&(e+="&"),e+=o}function require(url){eval(request(url))}function request(e,t,r){if(r=r||!1,void 0!==t&&t&&t!=={}){let r=t.headers||{},l=Object.keys(r).map(e=>e.toLowerCase());l.includes("user-agent")||(r["User-Agent"]=MOBILE_UA),l.includes("referer")||(r.Referer=getHome(e)),t.headers=r}else{if(!fetch_params||!fetch_params.headers){let e={"User-Agent":MOBILE_UA};rule.headers&&Object.assign(e,rule.headers),fetch_params||(fetch_params={}),fetch_params.headers=e}fetch_params.headers.Referer||(fetch_params.headers.Referer=getHome(e)),t=fetch_params}if(rule.encoding&&"utf-8"!==rule.encoding&&!r&&(t.headers.hasOwnProperty("Content-Type")||t.headers.hasOwnProperty("content-type")||(t.headers["Content-Type"]="text/html; charset="+rule.encoding)),void 0!==t.body&&t.body&&"string"==typeof t.body?t.headers.hasOwnProperty("Content-Type")||t.headers.hasOwnProperty("content-type")||(t.headers["Content-Type"]="application/x-www-form-urlencoded; charset="+rule.encoding):void 0!==t.body&&t.body&&"object"==typeof t.body&&(t.data=t.body,delete t.body),!e)return t.withHeaders?"{}":"";t.toBase64&&(t.buffer=2,delete t.toBase64),console.log(JSON.stringify(t.headers)),console.log("request:"+e+`|method:${t.method||"GET"}|body:${t.body||""}`);let l=req(e,t),o=l.content||"";if(t.withHeaders){let e=l.headers;return e.body=o,JSON.stringify(e)}return o}function post(e,t){return t.method="POST",request(e,t)}function checkHtml(e,t,r){if(/\?btwaf=/.test(e)){let l=e.match(/btwaf(.*?)"/)[1];t=t.split("#")[0]+"?btwaf"+l,print("宝塔验证访问链接:"+t),e=request(t,r)}return e}function getCode(e,t){let r=request(e,t);return r=checkHtml(r,e,t)}function getHtml(e){let t={};rule.headers&&(t.headers=rule.headers);let r=getItem(RULE_CK,"");return r&&(t.headers&&!Object.keys(t.headers).map(e=>e.toLowerCase()).includes("cookie")?(log("历史无cookie,新增过验证后的cookie"),t.headers.Cookie=r):t.headers&&t.headers.cookie&&t.headers.cookie!==r?(t.headers.Cookie=r,log("历史有小写过期的cookie,更新过验证后的cookie")):t.headers&&t.headers.Cookie&&t.headers.Cookie!==r?(t.headers.Cookie=r,log("历史有大写过期的cookie,更新过验证后的cookie")):t.headers||(t.headers={Cookie:r},log("历史无headers,更新过验证后的含cookie的headers"))),getCode(e,t)}function homeParse(e){fetch_params=JSON.parse(JSON.stringify(rule_fetch_params));let t=[];if(e.class_name&&e.class_url){let r=e.class_name.split("&"),l=e.class_url.split("&"),o=Math.min(r.length,l.length);for(let e=0;e<o;e++)t.push({type_id:l[e],type_name:r[e]})}if(e.class_parse){let r=e.class_parse.split(";"),l=parseTags.getParse(r[0]);if(_pdfa=l.pdfa,_pdfh=l.pdfh,_pd=l.pd,MY_URL=rule.url,r.length>=3)try{let l=getHtml(e.MY_URL);if(l){homeHtmlCache=l;let o=_pdfa(l,r[0]);o&&o.length>0&&o.forEach((l,o)=>{try{let s=_pdfh(l,r[1]);if(e.cate_exclude&&new RegExp(e.cate_exclude).test(s))return;let a=_pd(l,r[2]);if(r.length>3&&r[3]){let e=new RegExp(r[3]);a=a.match(e)[1]}t.push({type_id:a.trim(),type_name:s.trim()})}catch(e){console.log(`分类列表定位第${o}个元素正常报错:${e.message}`)}})}}catch(e){console.log(e.message)}}let r={class:t=t.filter(t=>!e.cate_exclude||!new RegExp(e.cate_exclude).test(t.type_name))};return e.filter&&(r.filters=e.filter),console.log(JSON.stringify(r)),JSON.stringify(r)}function getPP(e,t,r,l){try{return"*"===e[t]&&r.length>l?r[l]:e[t]}catch(e){return""}}function homeVodParse(homeVodObj){fetch_params=JSON.parse(JSON.stringify(rule_fetch_params));let d=[];MY_URL=homeVodObj.homeUrl,console.log(MY_URL);let t1=(new Date).getTime(),p=homeVodObj.推荐;if(print("p:"+p),"*"===p&&rule.一级&&(p=rule.一级,homeVodObj.double=!1),!p||"string"!=typeof p)return"{}";p=p.trim();let pp=rule.一级.split(";");if(p.startsWith("js:")){const TYPE="home";var input=MY_URL;HOST=rule.host,eval(p.replace("js:","")),d=VODS}else{if(p=p.split(";"),!homeVodObj.double&&p.length<5)return"{}";if(homeVodObj.double&&p.length<6)return"{}";let e=getPP(p,0,pp,0),t=parseTags.getParse(e);_pdfa=t.pdfa,_pdfh=t.pdfh,_pd=t.pd;let r=e.startsWith("json:");e=e.replace(/^(jsp:|json:|jq:)/,"");let l=homeHtmlCache||getHtml(MY_URL);homeHtmlCache=void 0,r&&(l=dealJson(l));try{if(console.log("double:"+homeVodObj.double),homeVodObj.double){let t=_pdfa(l,e),r=getPP(p,1,pp,0),o=getPP(p,2,pp,1),s=getPP(p,3,pp,2),a=getPP(p,4,pp,3),i=getPP(p,5,pp,4),n=getPP(p,6,pp,5);for(let e of t){let t=_pdfa(e,r);for(let e of t)try{let t=_pdfh(e,o),r="";try{r=_pd(e,s)}catch(e){}let l="";try{l=_pdfh(e,a)}catch(e){}let u=[],c;for(let t of i.split("+")){let r=homeVodObj.detailUrl?_pdfh(e,t):_pd(e,t,MY_URL);u.push(r)}c=p.length>6&&p[6]?_pdfh(e,n):"";let f=u.join("$");"*"===rule.二级&&(f=f+"@@"+t+"@@"+r);let h={vod_name:t,vod_pic:r,vod_remarks:l,vod_content:c,vod_id:f};d.push(h)}catch(e){console.log("首页列表双层定位处理发生错误:"+e.message)}}}else{let t=_pdfa(l,e),r=getPP(p,1,pp,1),o=getPP(p,2,pp,2),s=getPP(p,3,pp,3),a=getPP(p,4,pp,4),i=getPP(p,5,pp,5);for(let e of t)try{let t=_pdfh(e,r),l="";try{l=_pd(e,o,MY_URL)}catch(e){}let n="";try{n=_pdfh(e,s)}catch(e){}let u=[],c;for(let t of a.split("+")){let r=homeVodObj.detailUrl?_pdfh(e,t):_pd(e,t,MY_URL);u.push(r)}c=p.length>5&&p[5]?_pdfh(e,i):"";let f=u.join("$");"*"===rule.二级&&(f=f+"@@"+t+"@@"+l);let h={vod_name:t,vod_pic:l,vod_remarks:n,vod_content:c,vod_id:f};d.push(h)}catch(e){console.log("首页列表单层定位处理发生错误:"+e.message)}}}catch(e){}}let t2=(new Date).getTime();return console.log("加载首页推荐耗时:"+(t2-t1)+"毫秒"),rule.图片来源&&d.forEach(e=>{e.vod_pic&&e.vod_pic.startsWith("http")&&(e.vod_pic=e.vod_pic+rule.图片来源)}),d.length>0&&print(d.slice(0,2)),JSON.stringify({list:d})}function categoryParse(cateObj){fetch_params=JSON.parse(JSON.stringify(rule_fetch_params));let p=cateObj.一级;if(!p||"string"!=typeof p)return"{}";let d=[],url=cateObj.url.replaceAll("fyclass",cateObj.tid);if(1===cateObj.pg&&url.includes("[")&&url.includes("]")?url=url.split("[")[1].split("]")[0]:cateObj.pg>1&&url.includes("[")&&url.includes("]")&&(url=url.split("[")[0]),rule.filter_url){/fyfilter/.test(url)?url=url.replace("fyfilter",rule.filter_url):(url.endsWith("&")||rule.filter_url.startsWith("&")||(url+="&"),url+=rule.filter_url);let e=cateObj.filter?cateObj.extend:{},t;if(rule.filter_def&&"object"==typeof rule.filter_def)try{if(Object.keys(rule.filter_def).length>0&&rule.filter_def.hasOwnProperty(cateObj.tid)){let t=rule.filter_def[cateObj.tid];if(t&&"object"==typeof t){let r=JSON.parse(JSON.stringify(t));e=Object.assign(r,e)}}}catch(e){print("合并不同分类对应的默认筛选出错:"+e.message)}t=cheerio.jinja2(url,{fl:e}),url=t}if(/fypage/.test(url))if(url.includes("(")&&url.includes(")")){let url_rep=url.match(/.*?\((.*)\)/)[1],cnt_page=url_rep.replaceAll("fypage",cateObj.pg),cnt_pg=eval(cnt_page);url=url.replaceAll(url_rep,cnt_pg).replaceAll("(","").replaceAll(")","")}else url=url.replaceAll("fypage",cateObj.pg);MY_URL=url,console.log(MY_URL),p=p.trim();const MY_CATE=cateObj.tid;if(p.startsWith("js:")){var MY_FL=cateObj.extend;const TYPE="cate";var input=MY_URL;const MY_PAGE=cateObj.pg;var desc="";eval(p.trim().replace("js:","")),d=VODS}else{if(p=p.split(";"),p.length<5)return"{}";let e=parseTags.getParse(p[0]);_pdfa=e.pdfa,_pdfh=e.pdfh,_pd=e.pd;let t=p[0].startsWith("json:");p[0]=p[0].replace(/^(jsp:|json:|jq:)/,"");try{let e=getHtml(MY_URL);if(e){t&&(e=dealJson(e));let r=_pdfa(e,p[0]);r.forEach(e=>{let t=p[4].split("+").map(t=>rule.detailUrl?_pdfh(e,t):_pd(e,t,MY_URL)).join("$"),r=rule.detailUrl?MY_CATE+"$"+t:t,l=_pdfh(e,p[1]).replace(/\n|\t/g,"").trim(),o=_pd(e,p[2],MY_URL);"*"===rule.二级&&(r=r+"@@"+l+"@@"+o),d.push({vod_id:r,vod_name:l,vod_pic:o,vod_remarks:_pdfh(e,p[3]).replace(/\n|\t/g,"").trim()})})}}catch(e){console.log(e.message)}}rule.图片来源&&d.forEach(e=>{e.vod_pic&&e.vod_pic.startsWith("http")&&(e.vod_pic=e.vod_pic+rule.图片来源)}),d.length>0&&print(d.slice(0,2));let pagecount=0;rule.pagecount&&"object"==typeof rule.pagecount&&rule.pagecount.hasOwnProperty(MY_CATE)&&(print(`MY_CATE:${MY_CATE},pagecount:${JSON.stringify(rule.pagecount)}`),pagecount=parseInt(rule.pagecount[MY_CATE]));let nodata={list:[{vod_name:"无数据,防无限请求",vod_id:"no_data",vod_remarks:"不要点,会崩的",vod_pic:"https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg"}],total:1,pagecount:1,page:1,limit:1},vod=d.length<1?JSON.stringify(nodata):JSON.stringify({page:parseInt(cateObj.pg),pagecount:pagecount||999,limit:20,total:999,list:d});return vod}function searchParse(searchObj){fetch_params=JSON.parse(JSON.stringify(rule_fetch_params));let d=[];if(!searchObj.searchUrl)return"{}";let p="*"===searchObj.搜索&&rule.一级?rule.一级:searchObj.搜索;if(!p||"string"!=typeof p)return"{}";p=p.trim();let pp=rule.一级.split(";"),url=searchObj.searchUrl.replaceAll("**",searchObj.wd);if(1===searchObj.pg&&url.includes("[")&&url.includes("]")&&!url.includes("#")?url=url.split("[")[1].split("]")[0]:searchObj.pg>1&&url.includes("[")&&url.includes("]")&&!url.includes("#")&&(url=url.split("[")[0]),/fypage/.test(url))if(url.includes("(")&&url.includes(")")){let url_rep=url.match(/.*?\((.*)\)/)[1],cnt_page=url_rep.replaceAll("fypage",searchObj.pg),cnt_pg=eval(cnt_page);url=url.replaceAll(url_rep,cnt_pg).replaceAll("(","").replaceAll(")","")}else url=url.replaceAll("fypage",searchObj.pg);if(MY_URL=url,console.log(MY_URL),p.startsWith("js:")){const TYPE="search",MY_PAGE=searchObj.pg,KEY=searchObj.wd;var input=MY_URL,detailUrl=rule.detailUrl||"";eval(p.trim().replace("js:","")),d=VODS}else{if(p=p.split(";"),p.length<5)return"{}";let e=getPP(p,0,pp,0),t=parseTags.getParse(e);_pdfa=t.pdfa,_pdfh=t.pdfh,_pd=t.pd;let r=e.startsWith("json:");e=e.replace(/^(jsp:|json:|jq:)/,"");try{let t=MY_URL.split(";").length>1?MY_URL.split(";")[1].toLowerCase():"get",l;if("post"===t){let e=MY_URL.split(";")[0].split("#"),t=e[0],r=e.length>1?e[1]:"";print(`post=》rurl:${t},params:${r}`);let o=JSON.parse(JSON.stringify(rule_fetch_params)),s={body:r};Object.assign(o,s),l=post(t,o)}else if("postjson"===t){let e=MY_URL.split(";")[0].split("#"),t=e[0],r=e.length>1?e[1]:"";print(`postjson-》rurl:${t},params:${r}`);try{r=JSON.parse(r)}catch(e){r="{}"}let o=JSON.parse(JSON.stringify(rule_fetch_params)),s={body:r};Object.assign(o,s),l=post(t,o)}else l=getHtml(MY_URL);if(l){if(/系统安全验证|输入验证码/.test(l)){let e=verifyCode(MY_URL);e?(console.log(`本次成功过验证,cookie:${e}`),setItem(RULE_CK,e)):console.log(`本次自动过搜索验证失败,cookie:${e}`),l=getHtml(MY_URL)}l.includes(searchObj.wd)||(console.log("搜索结果源码未包含关键字,疑似搜索失败,正为您打印结果源码"),console.log(l)),r&&(l=dealJson(l));let t=_pdfa(l,e),o=getPP(p,1,pp,1),s=getPP(p,2,pp,2),a=getPP(p,3,pp,3),i=getPP(p,4,pp,4),n=getPP(p,5,pp,5);t.forEach(e=>{let t,r=i.split("+").map(t=>rule.detailUrl?_pdfh(e,t):_pd(e,t,MY_URL)).join("$");t=p.length>5&&p[5]?_pdfh(e,n):"";let l=r,u=_pdfh(e,o).replace(/\n|\t/g,"").trim(),c=_pd(e,s,MY_URL);"*"===rule.二级&&(l=l+"@@"+u+"@@"+c);let f={vod_id:l,vod_name:u,vod_pic:c,vod_remarks:_pdfh(e,a).replace(/\n|\t/g,"").trim(),vod_content:t.replace(/\n|\t/g,"").trim()};d.push(f)})}}catch(e){return print("搜索发生错误:"+e.message),"{}"}}return rule.图片来源&&d.forEach(e=>{e.vod_pic&&e.vod_pic.startsWith("http")&&(e.vod_pic=e.vod_pic+rule.图片来源)}),JSON.stringify({page:parseInt(searchObj.pg),pagecount:10,limit:20,total:100,list:d})}function detailParse(detailObj){let t1=(new Date).getTime();fetch_params=JSON.parse(JSON.stringify(rule_fetch_params));let orId=detailObj.orId,vod_name="片名",vod_pic="",vod_id=orId;if("*"===rule.二级){let e=orId.split("@@");vod_name=e.length>1?e[1]:vod_name,vod_pic=e.length>2?e[2]:vod_pic}let vod={vod_id:vod_id,vod_name:vod_name,vod_pic:vod_pic,type_name:"类型",vod_year:"年份",vod_area:"地区",vod_remarks:"更新信息",vod_actor:"主演",vod_director:"导演",vod_content:"简介"},p=detailObj.二级,url=detailObj.url,detailUrl=detailObj.detailUrl,fyclass=detailObj.fyclass,tab_exclude=detailObj.tab_exclude,html=detailObj.html||"";if(MY_URL=url,detailObj.二级访问前)try{print(`尝试在二级访问前执行代码:${detailObj.二级访问前}`),eval(detailObj.二级访问前.trim().replace("js:",""))}catch(e){print(`二级访问前执行代码出现错误:${e.message}`)}if("*"===p)vod.vod_play_from="公众号:开心软件",vod.vod_remarks=detailUrl,vod.vod_actor="没有二级,只有一级链接直接嗅探播放",vod.vod_content=MY_URL,vod.vod_play_url="嗅探播放$"+MY_URL.split("@@")[0];else if("string"==typeof p&&p.trim().startsWith("js:")){const TYPE="detail";var input=MY_URL,play_url="";eval(p.trim().replace("js:","")),vod=VOD,console.log(JSON.stringify(vod))}else if(p&&"object"==typeof p){let tt1=(new Date).getTime(),_ps;html||(html=getHtml(MY_URL)),print(`二级${MY_URL}仅获取源码耗时:${(new Date).getTime()-tt1}毫秒`),p.is_json?(print("二级是json"),_ps=parseTags.json,html=dealJson(html)):p.is_jsp?(print("二级是jsp"),_ps=parseTags.jsp):p.is_jq?(print("二级是jq"),_ps=parseTags.jq):(print("二级默认jq"),_ps=parseTags.jq);let tt2=(new Date).getTime();if(print(`二级${MY_URL}获取并装载源码耗时:${tt2-tt1}毫秒`),_pdfa=_ps.pdfa,_pdfh=_ps.pdfh,_pd=_ps.pd,p.title){let e=p.title.split(";");vod.vod_name=_pdfh(html,e[0]).replace(/\n|\t/g,"").trim();let t=e.length>1?_pdfh(html,e[1]).replace(/\n|\t/g,"").replace(/ /g,"").trim():"";vod.type_name=t||vod.type_name}if(p.desc)try{let e=p.desc.split(";");vod.vod_remarks=_pdfh(html,e[0]).replace(/\n|\t/g,"").trim(),vod.vod_year=e.length>1?_pdfh(html,e[1]).replace(/\n|\t/g,"").trim():"",vod.vod_area=e.length>2?_pdfh(html,e[2]).replace(/\n|\t/g,"").trim():"",vod.vod_actor=e.length>3?_pdfh(html,e[3]).replace(/\n|\t/g,"").trim():"",vod.vod_director=e.length>4?_pdfh(html,e[4]).replace(/\n|\t/g,"").trim():""}catch(e){}if(p.content)try{let e=p.content.split(";");vod.vod_content=_pdfh(html,e[0]).replace(/\n|\t/g,"").trim()}catch(e){}if(p.img)try{let e=p.img.split(";");vod.vod_pic=_pd(html,e[0],MY_URL)}catch(e){}let vod_play_from="$$$",playFrom=[];if(p.重定向&&p.重定向.startsWith("js:")&&(print("开始执行重定向代码:"+p.重定向),html=eval(p.重定向.replace("js:",""))),p.tabs){if(p.tabs.startsWith("js:")){print("开始执行tabs代码:"+p.tabs);var input=MY_URL;eval(p.tabs.replace("js:","")),playFrom=TABS}else{let e=p.tabs.split(";")[0],t=_pdfa(html,e);console.log(t.length);let r=p.tab_text||"body&&Text",l={};for(let e of t){let t=_pdfh(e,r).trim();console.log(t),tab_exclude&&new RegExp(tab_exclude).test(t)||(l.hasOwnProperty(t)?l[t]+=1:l[t]=1,l[t]>1&&(t+=Number(l[t]-1)),playFrom.push(t))}}console.log(JSON.stringify(playFrom))}else playFrom=["公众号:开心软件"];vod.vod_play_from=playFrom.join(vod_play_from);let vod_play_url="$$$",vod_tab_list=[];if(p.lists)if(p.lists.startsWith("js:")){print("开始执行lists代码:"+p.lists);try{var input=MY_URL,play_url="";eval(p.lists.replace("js:",""));for(let e in LISTS)if(LISTS.hasOwnProperty(e))try{LISTS[e]=LISTS[e].map(e=>e.split("$").slice(0,2).join("$"))}catch(e){print("格式化LISTS发生错误:"+e.message)}vod_play_url=LISTS.map(e=>e.join("#")).join(vod_play_url)}catch(e){print("js执行lists: 发生错误:"+e.message)}}else{let e=p.list_text||"body&&Text",t=p.list_url||"a&&href",r=p.tabs.trim().startsWith("js:");for(let l=0;l<playFrom.length;l++){let o=playFrom[l],s=p.tabs.split(";").length>1&&!r?p.tabs.split(";")[1]:"",a=p.lists.replaceAll("#idv",o).replaceAll("#id",l);s=s.replaceAll("#idv",o).replaceAll("#id",l);let i=s?_pdfh(html,s):o;console.log(i);let n=[],u=(new Date).getTime();if("function"==typeof pdfl)n=pdfl(html,a,e,t,MY_URL);else{let r=[];try{r=_pdfa(html,a),console.log("len(vodList):"+r.length)}catch(e){}for(let l=0;l<r.length;l++){let o=r[l];n.push(_pdfh(o,e).trim()+"$"+_pd(o,t,MY_URL))}}n.length>0&&(n=forceOrder(n,"",e=>e.split("$")[0]),console.log(`drpy影响性能代码共计列表数循环次数:${n.length},耗时:${(new Date).getTime()-u}毫秒`));let c=n.join("#");vod_tab_list.push(c)}vod_play_url=vod_tab_list.join(vod_play_url)}vod.vod_play_url=vod_play_url}rule.图片来源&&vod.vod_pic&&vod.vod_pic.startsWith("http")&&(vod.vod_pic=vod.vod_pic+rule.图片来源),(!vod.vod_id||vod_id.includes("$")&&vod.vod_id!==vod_id)&&(vod.vod_id=vod_id);let t2=(new Date).getTime();return console.log(`加载二级界面${MY_URL}耗时:${t2-t1}毫秒`),vod=vodDeal(vod),void 0!==vod.type_name?vod.type_name=vod.type_name+" | 公众号:开心软件":vod.type_name="公众号:开心软件",JSON.stringify({list:[vod]})}function get_tab_index(e){let t={};return e.vod_play_from.split("$$$").forEach((e,r)=>{t[e]=r}),t}function vodDeal(e){let t=e.vod_play_from.split("$$$"),r=e.vod_play_url.split("$$$"),l=t,o=t,s=t,a=t,i=r;if(rule.tab_remove&&rule.tab_remove.length>0||rule.tab_order&&rule.tab_order.length>0){let s=get_tab_index(e);if(rule.tab_remove&&rule.tab_remove.length>0&&(a=l=t.filter(e=>!rule.tab_remove.includes(e))),rule.tab_order&&rule.tab_order.length>0){let e=rule.tab_order;a=o=l.sort((t,r)=>(-1===e.indexOf(t)?9999:e.indexOf(t))-(-1===e.indexOf(r)?9999:e.indexOf(r)))}i=a.map(e=>r[s[e]])}return rule.tab_rename&&"object"==typeof rule.tab_rename&Object.keys(rule.tab_rename).length>0&&(a=s=a.map(e=>rule.tab_rename[e]||e)),e.vod_play_from=a.join("$$$"),e.vod_play_url=i.join("$$$"),e}function tellIsJx(e){try{return!/\.(m3u8|mp4|m4a)$/.test(e.split("?")[0])&&是否正版(e)?1:0}catch(e){return 1}}function playParse(playObj){if(fetch_params=JSON.parse(JSON.stringify(rule_fetch_params)),MY_URL=playObj.url,!/http/.test(MY_URL))try{MY_URL=base64Decode(MY_URL)}catch(e){}MY_URL=decodeURIComponent(MY_URL);var input=MY_URL;let common_play={parse:1,url:input,jx:tellIsJx(input)},lazy_play;if(rule.play_parse&&rule.lazy)if(rule.play_parse&&rule.lazy&&"string"==typeof rule.lazy)try{let lazy_code=rule.lazy.replace("js:","").trim();print("开始执行js免嗅=>"+lazy_code),eval(lazy_code),lazy_play="object"==typeof input?input:{parse:1,jx:tellIsJx(input),url:input}}catch(e){print("js免嗅错误:"+e.message),lazy_play=common_play}else lazy_play=common_play;else lazy_play=common_play;if(Array.isArray(rule.play_json)&&rule.play_json.length>0){let e=lazy_play.url;for(let t of rule.play_json)if(t.re&&("*"===t.re||e.match(new RegExp(t.re)))&&t.json&&"object"==typeof t.json){let e=t.json;lazy_play=Object.assign(lazy_play,e);break}}else if(rule.play_json&&!Array.isArray(rule.play_json)){let e={jx:1,parse:1};lazy_play=Object.assign(lazy_play,e)}else if(!rule.play_json){let e={jx:0,parse:1};lazy_play=Object.assign(lazy_play,e)}return console.log(JSON.stringify(lazy_play)),JSON.stringify(lazy_play)}function proxyParse(proxyObj){var input=proxyObj.params;if(!proxyObj.proxy_rule)return[404,"text/plain","Not Found"];log("准备执行本地代理规则:\n"+proxyObj.proxy_rule);try{return eval(proxyObj.proxy_rule),input&&input!==proxyObj.params&&Array.isArray(input)&&3===input.length?input:[404,"text/plain","Not Found"]}catch(e){return[500,"text/plain","代理规则错误:"+e.message]}}function isVideoParse(isVideoObj){var input=isVideoObj.url;if(!isVideoObj.t){let e=new RegExp(isVideoObj.isVideo,"i");return e.test(input)}try{return eval(isVideoObj.isVideo),"boolean"==typeof input&&input}catch(e){return log("执行嗅探规则发生错误:"+e.message),!1}}function init(ext){console.log("init");try{let muban=模板.getMubans();if("object"==typeof ext)rule=ext;else if("string"==typeof ext)if(ext.startsWith("http")){let js=request(ext,{method:"GET"});js.startsWith("**")&&(js=base64Decode(js.substring(2))),js&&eval(js.replace("var rule","rule"))}else eval(ext.replace("var rule","rule"));rule.模板&&muban.hasOwnProperty(rule.模板)&&(print("继承模板:"+rule.模板),rule=Object.assign(muban[rule.模板],rule));let rule_cate_excludes=(rule.cate_exclude||"").split("|").filter(e=>e.trim()),rule_tab_excludes=(rule.tab_exclude||"").split("|").filter(e=>e.trim());if(rule_cate_excludes=rule_cate_excludes.concat(CATE_EXCLUDE.split("|").filter(e=>e.trim())),rule_tab_excludes=rule_tab_excludes.concat(TAB_EXCLUDE.split("|").filter(e=>e.trim())),rule.cate_exclude=rule_cate_excludes.join("|"),rule.tab_exclude=rule_tab_excludes.join("|"),rule.host=(rule.host||"").rstrip("/"),HOST=rule.host,rule.hostJs){console.log("检测到hostJs,准备执行...");try{eval(rule.hostJs),rule.host=HOST.rstrip("/")}catch(e){console.log(`执行${rule.hostJs}获取host发生错误:`+e.message)}}if(rule.url=rule.url||"",rule.double=rule.double||!1,rule.homeUrl=rule.homeUrl||"",rule.detailUrl=rule.detailUrl||"",rule.searchUrl=rule.searchUrl||"",rule.homeUrl=rule.host&&rule.homeUrl?urljoin(rule.host,rule.homeUrl):rule.homeUrl||rule.host,rule.detailUrl=rule.host&&rule.detailUrl?urljoin(rule.host,rule.detailUrl):rule.detailUrl,rule.二级访问前=rule.二级访问前||"",rule.url.includes("[")&&rule.url.includes("]")){let e=rule.url.split("[")[0],t=rule.url.split("[")[1].split("]")[0];rule.url=rule.host&&rule.url?urljoin(rule.host,e)+"["+urljoin(rule.host,t)+"]":rule.url}else rule.url=rule.host&&rule.url?urljoin(rule.host,rule.url):rule.url;if(rule.searchUrl.includes("[")&&rule.searchUrl.includes("]")&&!rule.searchUrl.includes("#")){let e=rule.searchUrl.split("[")[0],t=rule.searchUrl.split("[")[1].split("]")[0];rule.searchUrl=rule.host&&rule.searchUrl?urljoin(rule.host,e)+"["+urljoin(rule.host,t)+"]":rule.searchUrl}else rule.searchUrl=rule.host&&rule.searchUrl?urljoin(rule.host,rule.searchUrl):rule.searchUrl;if(rule.timeout=rule.timeout||5e3,rule.encoding=rule.编码||rule.encoding||"utf-8",rule.search_encoding=rule.搜索编码||rule.search_encoding||"",rule.图片来源=rule.图片来源||"",rule.play_json=rule.hasOwnProperty("play_json")?rule.play_json:[],rule.pagecount=rule.hasOwnProperty("pagecount")?rule.pagecount:{},rule.proxy_rule=rule.hasOwnProperty("proxy_rule")?rule.proxy_rule:"",rule.sniffer=rule.hasOwnProperty("sniffer")?rule.sniffer:"",rule.sniffer=!(!rule.sniffer||"0"===rule.sniffer||"false"===rule.sniffer),rule.isVideo=rule.hasOwnProperty("isVideo")?rule.isVideo:"",rule.tab_remove=rule.hasOwnProperty("tab_remove")?rule.tab_remove:[],rule.tab_order=rule.hasOwnProperty("tab_order")?rule.tab_order:[],rule.tab_rename=rule.hasOwnProperty("tab_rename")?rule.tab_rename:{},rule.headers&&"object"==typeof rule.headers)try{let header_keys=Object.keys(rule.headers);for(let k of header_keys)if("user-agent"===k.toLowerCase()){let v=rule.headers[k];console.log(v),["MOBILE_UA","PC_UA","UC_UA","IOS_UA","UA"].includes(v)&&(rule.headers[k]=eval(v))}else if("cookie"===k.toLowerCase()){let e=rule.headers[k];if(e&&e.startsWith("http")){console.log(e);try{e=fetch(e),console.log(e),rule.headers[k]=e}catch(t){console.log(`从${e}获取cookie发生错误:`+t.message)}}}}catch(e){console.log("处理headers发生错误:"+e.message)}rule_fetch_params={headers:rule.headers||!1,timeout:rule.timeout,encoding:rule.encoding},oheaders=rule.headers||{},RKEY="undefined"!=typeof key&&key?key:"drpy_"+(rule.title||rule.host),pre(),init_test()}catch(e){console.log("init_test发生错误:"+e.message)}}fetch=request,print=function(e){if("object"==typeof(e=e||"")&&Object.keys(e).length>0)try{e=JSON.stringify(e),console.log(e)}catch(t){return void console.log(typeof e+":"+e.length)}else"object"==typeof e&&Object.keys(e).length<1?console.log("null object"):console.log(e)},log=print;let homeHtmlCache=void 0;function home(e){return console.log("home"),homeParse({filter:rule.filter||!1,MY_URL:rule.homeUrl,class_name:rule.class_name||"",class_url:rule.class_url||"",class_parse:rule.class_parse||"",cate_exclude:rule.cate_exclude})}function homeVod(e){return console.log("homeVod"),homeVodParse({"推荐":rule.推荐,double:rule.double,homeUrl:rule.homeUrl,detailUrl:rule.detailUrl})}function category(e,t,r,l){return categoryParse({url:rule.url,"一级":rule.一级,tid:e,pg:parseInt(t),filter:r,extend:l})}function detail(e){let t=e,r="";if(log("orId:"+t),e.indexOf("$")>-1){let t=e.split("$");r=t[0],e=t[1]}let l,o=e.split("@@")[0];return detailParse({orId:t,url:l=o.startsWith("http")||o.includes("/")?o.includes("/")?urljoin(rule.homeUrl,o):o:rule.detailUrl.replaceAll("fyid",o).replaceAll("fyclass",r),"二级":rule.二级,"二级访问前":rule.二级访问前,detailUrl:o,fyclass:r,tab_exclude:rule.tab_exclude})}function play(e,t,r){return playParse({url:t,flag:e,flags:r})}function search(e,t,r){return rule.search_encoding?"utf-8"!==rule.search_encoding.toLowerCase()&&(e=encodeStr(e,rule.search_encoding)):rule.encoding&&"utf-8"!==rule.encoding.toLowerCase()&&(e=encodeStr(e,rule.encoding)),searchParse({searchUrl:rule.searchUrl,"搜索":rule.搜索,wd:e,pg:r||1,quick:t})}function proxy(e){return rule.proxy_rule&&rule.proxy_rule.trim()&&(rule.proxy_rule=rule.proxy_rule.trim()),rule.proxy_rule.startsWith("js:")&&(rule.proxy_rule=rule.proxy_rule.replace("js:","")),proxyParse({params:e,proxy_rule:rule.proxy_rule})}function sniffer(){let e=rule.sniffer||!1;return e&&log("开始执行辅助嗅探代理规则..."),e}function isVideo(e){let t,r=0;rule.isVideo&&rule.isVideo.trim()&&(t=rule.isVideo.trim()),t.startsWith("js:")&&(t=t.replace("js:",""),r=1);let l=isVideoParse({url:e,isVideo:t,t:r});return l&&log("成功执行辅助嗅探规则并检测到视频地址:\n"+rule.isVideo),l}function DRPY(){return{init:init,home:home,homeVod:homeVod,category:category,detail:detail,play:play,search:search,proxy:proxy,sniffer:sniffer,isVideo:isVideo}}export default{init:init,home:home,homeVod:homeVod,category:category,detail:detail,play:play,search:search,proxy:proxy,sniffer:sniffer,isVideo:isVideo,DRPY:DRPY};
|
||||
File diff suppressed because one or more lines are too long
+577
@@ -0,0 +1,577 @@
|
||||
/*!
|
||||
* Jinja Templating for JavaScript v0.1.8
|
||||
* https://github.com/sstur/jinja-js
|
||||
*
|
||||
* This is a slimmed-down Jinja2 implementation [http://jinja.pocoo.org/]
|
||||
*
|
||||
* In the interest of simplicity, it deviates from Jinja2 as follows:
|
||||
* - Line statements, cycle, super, macro tags and block nesting are not implemented
|
||||
* - auto escapes html by default (the filter is "html" not "e")
|
||||
* - Only "html" and "safe" filters are built in
|
||||
* - Filters are not valid in expressions; `foo|length > 1` is not valid
|
||||
* - Expression Tests (`if num is odd`) not implemented (`is` translates to `==` and `isnot` to `!=`)
|
||||
*
|
||||
* Notes:
|
||||
* - if property is not found, but method '_get' exists, it will be called with the property name (and cached)
|
||||
* - `{% for n in obj %}` iterates the object's keys; get the value with `{% for n in obj %}{{ obj[n] }}{% endfor %}`
|
||||
* - subscript notation `a[0]` takes literals or simple variables but not `a[item.key]`
|
||||
* - `.2` is not a valid number literal; use `0.2`
|
||||
*
|
||||
*/
|
||||
/*global require, exports, module, define */
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jinja = {}));
|
||||
})(this, (function (jinja) {
|
||||
"use strict";
|
||||
var STRINGS = /'(\\.|[^'])*'|"(\\.|[^"'"])*"/g;
|
||||
var IDENTS_AND_NUMS = /([$_a-z][$\w]*)|([+-]?\d+(\.\d+)?)/g;
|
||||
var NUMBER = /^[+-]?\d+(\.\d+)?$/;
|
||||
//non-primitive literals (array and object literals)
|
||||
var NON_PRIMITIVES = /\[[@#~](,[@#~])*\]|\[\]|\{([@i]:[@#~])(,[@i]:[@#~])*\}|\{\}/g;
|
||||
//bare identifiers such as variables and in object literals: {foo: 'value'}
|
||||
var IDENTIFIERS = /[$_a-z][$\w]*/ig;
|
||||
var VARIABLES = /i(\.i|\[[@#i]\])*/g;
|
||||
var ACCESSOR = /(\.i|\[[@#i]\])/g;
|
||||
var OPERATORS = /(===?|!==?|>=?|<=?|&&|\|\||[+\-\*\/%])/g;
|
||||
//extended (english) operators
|
||||
var EOPS = /(^|[^$\w])(and|or|not|is|isnot)([^$\w]|$)/g;
|
||||
var LEADING_SPACE = /^\s+/;
|
||||
var TRAILING_SPACE = /\s+$/;
|
||||
|
||||
var START_TOKEN = /\{\{\{|\{\{|\{%|\{#/;
|
||||
var TAGS = {
|
||||
'{{{': /^('(\\.|[^'])*'|"(\\.|[^"'"])*"|.)+?\}\}\}/,
|
||||
'{{': /^('(\\.|[^'])*'|"(\\.|[^"'"])*"|.)+?\}\}/,
|
||||
'{%': /^('(\\.|[^'])*'|"(\\.|[^"'"])*"|.)+?%\}/,
|
||||
'{#': /^('(\\.|[^'])*'|"(\\.|[^"'"])*"|.)+?#\}/
|
||||
};
|
||||
|
||||
var delimeters = {
|
||||
'{%': 'directive',
|
||||
'{{': 'output',
|
||||
'{#': 'comment'
|
||||
};
|
||||
|
||||
var operators = {
|
||||
and: '&&',
|
||||
or: '||',
|
||||
not: '!',
|
||||
is: '==',
|
||||
isnot: '!='
|
||||
};
|
||||
|
||||
var constants = {
|
||||
'true': true,
|
||||
'false': false,
|
||||
'null': null
|
||||
};
|
||||
|
||||
function Parser() {
|
||||
this.nest = [];
|
||||
this.compiled = [];
|
||||
this.childBlocks = 0;
|
||||
this.parentBlocks = 0;
|
||||
this.isSilent = false;
|
||||
}
|
||||
|
||||
Parser.prototype.push = function (line) {
|
||||
if (!this.isSilent) {
|
||||
this.compiled.push(line);
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.parse = function (src) {
|
||||
this.tokenize(src);
|
||||
return this.compiled;
|
||||
};
|
||||
|
||||
Parser.prototype.tokenize = function (src) {
|
||||
var lastEnd = 0, parser = this, trimLeading = false;
|
||||
matchAll(src, START_TOKEN, function (open, index, src) {
|
||||
//here we match the rest of the src against a regex for this tag
|
||||
var match = src.slice(index + open.length).match(TAGS[open]);
|
||||
match = (match ? match[0] : '');
|
||||
//here we sub out strings so we don't get false matches
|
||||
var simplified = match.replace(STRINGS, '@');
|
||||
//if we don't have a close tag or there is a nested open tag
|
||||
if (!match || ~simplified.indexOf(open)) {
|
||||
return index + 1;
|
||||
}
|
||||
var inner = match.slice(0, 0 - open.length);
|
||||
//check for white-space collapse syntax
|
||||
if (inner.charAt(0) === '-') var wsCollapseLeft = true;
|
||||
if (inner.slice(-1) === '-') var wsCollapseRight = true;
|
||||
inner = inner.replace(/^-|-$/g, '').trim();
|
||||
//if we're in raw mode and we are not looking at an "endraw" tag, move along
|
||||
if (parser.rawMode && (open + inner) !== '{%endraw') {
|
||||
return index + 1;
|
||||
}
|
||||
var text = src.slice(lastEnd, index);
|
||||
lastEnd = index + open.length + match.length;
|
||||
if (trimLeading) text = trimLeft(text);
|
||||
if (wsCollapseLeft) text = trimRight(text);
|
||||
if (wsCollapseRight) trimLeading = true;
|
||||
if (open === '{{{') {
|
||||
//liquid-style: make {{{x}}} => {{x|safe}}
|
||||
open = '{{';
|
||||
inner += '|safe';
|
||||
}
|
||||
parser.textHandler(text);
|
||||
parser.tokenHandler(open, inner);
|
||||
});
|
||||
var text = src.slice(lastEnd);
|
||||
if (trimLeading) text = trimLeft(text);
|
||||
this.textHandler(text);
|
||||
};
|
||||
|
||||
Parser.prototype.textHandler = function (text) {
|
||||
this.push('write(' + JSON.stringify(text) + ');');
|
||||
};
|
||||
|
||||
Parser.prototype.tokenHandler = function (open, inner) {
|
||||
var type = delimeters[open];
|
||||
if (type === 'directive') {
|
||||
this.compileTag(inner);
|
||||
} else if (type === 'output') {
|
||||
var extracted = this.extractEnt(inner, STRINGS, '@');
|
||||
//replace || operators with ~
|
||||
extracted.src = extracted.src.replace(/\|\|/g, '~').split('|');
|
||||
//put back || operators
|
||||
extracted.src = extracted.src.map(function (part) {
|
||||
return part.split('~').join('||');
|
||||
});
|
||||
var parts = this.injectEnt(extracted, '@');
|
||||
if (parts.length > 1) {
|
||||
var filters = parts.slice(1).map(this.parseFilter.bind(this));
|
||||
this.push('filter(' + this.parseExpr(parts[0]) + ',' + filters.join(',') + ');');
|
||||
} else {
|
||||
this.push('filter(' + this.parseExpr(parts[0]) + ');');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Parser.prototype.compileTag = function (str) {
|
||||
var directive = str.split(' ')[0];
|
||||
var handler = tagHandlers[directive];
|
||||
if (!handler) {
|
||||
throw new Error('Invalid tag: ' + str);
|
||||
}
|
||||
handler.call(this, str.slice(directive.length).trim());
|
||||
};
|
||||
|
||||
Parser.prototype.parseFilter = function (src) {
|
||||
src = src.trim();
|
||||
var match = src.match(/[:(]/);
|
||||
var i = match ? match.index : -1;
|
||||
if (i < 0) return JSON.stringify([src]);
|
||||
var name = src.slice(0, i);
|
||||
var args = src.charAt(i) === ':' ? src.slice(i + 1) : src.slice(i + 1, -1);
|
||||
args = this.parseExpr(args, {terms: true});
|
||||
return '[' + JSON.stringify(name) + ',' + args + ']';
|
||||
};
|
||||
|
||||
Parser.prototype.extractEnt = function (src, regex, placeholder) {
|
||||
var subs = [], isFunc = typeof placeholder == 'function';
|
||||
src = src.replace(regex, function (str) {
|
||||
var replacement = isFunc ? placeholder(str) : placeholder;
|
||||
if (replacement) {
|
||||
subs.push(str);
|
||||
return replacement;
|
||||
}
|
||||
return str;
|
||||
});
|
||||
return {src: src, subs: subs};
|
||||
};
|
||||
|
||||
Parser.prototype.injectEnt = function (extracted, placeholder) {
|
||||
var src = extracted.src, subs = extracted.subs, isArr = Array.isArray(src);
|
||||
var arr = (isArr) ? src : [src];
|
||||
var re = new RegExp('[' + placeholder + ']', 'g'), i = 0;
|
||||
arr.forEach(function (src, index) {
|
||||
arr[index] = src.replace(re, function () {
|
||||
return subs[i++];
|
||||
});
|
||||
});
|
||||
return isArr ? arr : arr[0];
|
||||
};
|
||||
|
||||
//replace complex literals without mistaking subscript notation with array literals
|
||||
Parser.prototype.replaceComplex = function (s) {
|
||||
var parsed = this.extractEnt(s, /i(\.i|\[[@#i]\])+/g, 'v');
|
||||
parsed.src = parsed.src.replace(NON_PRIMITIVES, '~');
|
||||
return this.injectEnt(parsed, 'v');
|
||||
};
|
||||
|
||||
//parse expression containing literals (including objects/arrays) and variables (including dot and subscript notation)
|
||||
//valid expressions: `a + 1 > b.c or c == null`, `a and b[1] != c`, `(a < b) or (c < d and e)`, 'a || [1]`
|
||||
Parser.prototype.parseExpr = function (src, opts) {
|
||||
opts = opts || {};
|
||||
//extract string literals -> @
|
||||
var parsed1 = this.extractEnt(src, STRINGS, '@');
|
||||
//note: this will catch {not: 1} and a.is; could we replace temporarily and then check adjacent chars?
|
||||
parsed1.src = parsed1.src.replace(EOPS, function (s, before, op, after) {
|
||||
return (op in operators) ? before + operators[op] + after : s;
|
||||
});
|
||||
//sub out non-string literals (numbers/true/false/null) -> #
|
||||
// the distinction is necessary because @ can be object identifiers, # cannot
|
||||
var parsed2 = this.extractEnt(parsed1.src, IDENTS_AND_NUMS, function (s) {
|
||||
return (s in constants || NUMBER.test(s)) ? '#' : null;
|
||||
});
|
||||
//sub out object/variable identifiers -> i
|
||||
var parsed3 = this.extractEnt(parsed2.src, IDENTIFIERS, 'i');
|
||||
//remove white-space
|
||||
parsed3.src = parsed3.src.replace(/\s+/g, '');
|
||||
|
||||
//the rest of this is simply to boil the expression down and check validity
|
||||
var simplified = parsed3.src;
|
||||
//sub out complex literals (objects/arrays) -> ~
|
||||
// the distinction is necessary because @ and # can be subscripts but ~ cannot
|
||||
while (simplified !== (simplified = this.replaceComplex(simplified))) ;
|
||||
//now @ represents strings, # represents other primitives and ~ represents non-primitives
|
||||
//replace complex variables (those with dot/subscript accessors) -> v
|
||||
while (simplified !== (simplified = simplified.replace(/i(\.i|\[[@#i]\])+/, 'v'))) ;
|
||||
//empty subscript or complex variables in subscript, are not permitted
|
||||
simplified = simplified.replace(/[iv]\[v?\]/g, 'x');
|
||||
//sub in "i" for @ and # and ~ and v (now "i" represents all literals, variables and identifiers)
|
||||
simplified = simplified.replace(/[@#~v]/g, 'i');
|
||||
//sub out operators
|
||||
simplified = simplified.replace(OPERATORS, '%');
|
||||
//allow 'not' unary operator
|
||||
simplified = simplified.replace(/!+[i]/g, 'i');
|
||||
var terms = opts.terms ? simplified.split(',') : [simplified];
|
||||
terms.forEach(function (term) {
|
||||
//simplify logical grouping
|
||||
while (term !== (term = term.replace(/\(i(%i)*\)/g, 'i'))) ;
|
||||
if (!term.match(/^i(%i)*/)) {
|
||||
throw new Error('Invalid expression: ' + src + " " + term);
|
||||
}
|
||||
});
|
||||
parsed3.src = parsed3.src.replace(VARIABLES, this.parseVar.bind(this));
|
||||
parsed2.src = this.injectEnt(parsed3, 'i');
|
||||
parsed1.src = this.injectEnt(parsed2, '#');
|
||||
return this.injectEnt(parsed1, '@');
|
||||
};
|
||||
|
||||
Parser.prototype.parseVar = function (src) {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var str = args.pop(), index = args.pop();
|
||||
//quote bare object identifiers (might be a reserved word like {while: 1})
|
||||
if (src === 'i' && str.charAt(index + 1) === ':') {
|
||||
return '"i"';
|
||||
}
|
||||
var parts = ['"i"'];
|
||||
src.replace(ACCESSOR, function (part) {
|
||||
if (part === '.i') {
|
||||
parts.push('"i"');
|
||||
} else if (part === '[i]') {
|
||||
parts.push('get("i")');
|
||||
} else {
|
||||
parts.push(part.slice(1, -1));
|
||||
}
|
||||
});
|
||||
return 'get(' + parts.join(',') + ')';
|
||||
};
|
||||
|
||||
//escapes a name to be used as a javascript identifier
|
||||
Parser.prototype.escName = function (str) {
|
||||
return str.replace(/\W/g, function (s) {
|
||||
return '$' + s.charCodeAt(0).toString(16);
|
||||
});
|
||||
};
|
||||
|
||||
Parser.prototype.parseQuoted = function (str) {
|
||||
if (str.charAt(0) === "'") {
|
||||
str = str.slice(1, -1).replace(/\\.|"/, function (s) {
|
||||
if (s === "\\'") return "'";
|
||||
return s.charAt(0) === '\\' ? s : ('\\' + s);
|
||||
});
|
||||
str = '"' + str + '"';
|
||||
}
|
||||
//todo: try/catch or deal with invalid characters (linebreaks, control characters)
|
||||
return JSON.parse(str);
|
||||
};
|
||||
|
||||
|
||||
//the context 'this' inside tagHandlers is the parser instance
|
||||
var tagHandlers = {
|
||||
'if': function (expr) {
|
||||
this.push('if (' + this.parseExpr(expr) + ') {');
|
||||
this.nest.unshift('if');
|
||||
},
|
||||
'else': function () {
|
||||
if (this.nest[0] === 'for') {
|
||||
this.push('}, function() {');
|
||||
} else {
|
||||
this.push('} else {');
|
||||
}
|
||||
},
|
||||
'elseif': function (expr) {
|
||||
this.push('} else if (' + this.parseExpr(expr) + ') {');
|
||||
},
|
||||
'endif': function () {
|
||||
this.nest.shift();
|
||||
this.push('}');
|
||||
},
|
||||
'for': function (str) {
|
||||
var i = str.indexOf(' in ');
|
||||
var name = str.slice(0, i).trim();
|
||||
var expr = str.slice(i + 4).trim();
|
||||
this.push('each(' + this.parseExpr(expr) + ',' + JSON.stringify(name) + ',function() {');
|
||||
this.nest.unshift('for');
|
||||
},
|
||||
'endfor': function () {
|
||||
this.nest.shift();
|
||||
this.push('});');
|
||||
},
|
||||
'raw': function () {
|
||||
this.rawMode = true;
|
||||
},
|
||||
'endraw': function () {
|
||||
this.rawMode = false;
|
||||
},
|
||||
'set': function (stmt) {
|
||||
var i = stmt.indexOf('=');
|
||||
var name = stmt.slice(0, i).trim();
|
||||
var expr = stmt.slice(i + 1).trim();
|
||||
this.push('set(' + JSON.stringify(name) + ',' + this.parseExpr(expr) + ');');
|
||||
},
|
||||
'block': function (name) {
|
||||
if (this.isParent) {
|
||||
++this.parentBlocks;
|
||||
var blockName = 'block_' + (this.escName(name) || this.parentBlocks);
|
||||
this.push('block(typeof ' + blockName + ' == "function" ? ' + blockName + ' : function() {');
|
||||
} else if (this.hasParent) {
|
||||
this.isSilent = false;
|
||||
++this.childBlocks;
|
||||
blockName = 'block_' + (this.escName(name) || this.childBlocks);
|
||||
this.push('function ' + blockName + '() {');
|
||||
}
|
||||
this.nest.unshift('block');
|
||||
},
|
||||
'endblock': function () {
|
||||
this.nest.shift();
|
||||
if (this.isParent) {
|
||||
this.push('});');
|
||||
} else if (this.hasParent) {
|
||||
this.push('}');
|
||||
this.isSilent = true;
|
||||
}
|
||||
},
|
||||
'extends': function (name) {
|
||||
name = this.parseQuoted(name);
|
||||
var parentSrc = this.readTemplateFile(name);
|
||||
this.isParent = true;
|
||||
this.tokenize(parentSrc);
|
||||
this.isParent = false;
|
||||
this.hasParent = true;
|
||||
//silence output until we enter a child block
|
||||
this.isSilent = true;
|
||||
},
|
||||
'include': function (name) {
|
||||
name = this.parseQuoted(name);
|
||||
var incSrc = this.readTemplateFile(name);
|
||||
this.isInclude = true;
|
||||
this.tokenize(incSrc);
|
||||
this.isInclude = false;
|
||||
}
|
||||
};
|
||||
|
||||
//liquid style
|
||||
tagHandlers.assign = tagHandlers.set;
|
||||
//python/django style
|
||||
tagHandlers.elif = tagHandlers.elseif;
|
||||
|
||||
var getRuntime = function runtime(data, opts) {
|
||||
var defaults = {autoEscape: 'toJson'};
|
||||
var _toString = Object.prototype.toString;
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var getKeys = Object.keys || function (obj) {
|
||||
var keys = [];
|
||||
for (var n in obj) if (_hasOwnProperty.call(obj, n)) keys.push(n);
|
||||
return keys;
|
||||
};
|
||||
var isArray = Array.isArray || function (obj) {
|
||||
return _toString.call(obj) === '[object Array]';
|
||||
};
|
||||
var create = Object.create || function (obj) {
|
||||
function F() {
|
||||
}
|
||||
|
||||
F.prototype = obj;
|
||||
return new F();
|
||||
};
|
||||
var toString = function (val) {
|
||||
if (val == null) return '';
|
||||
return (typeof val.toString == 'function') ? val.toString() : _toString.call(val);
|
||||
};
|
||||
var extend = function (dest, src) {
|
||||
var keys = getKeys(src);
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i];
|
||||
dest[key] = src[key];
|
||||
}
|
||||
return dest;
|
||||
};
|
||||
//get a value, lexically, starting in current context; a.b -> get("a","b")
|
||||
var get = function () {
|
||||
var val, n = arguments[0], c = stack.length;
|
||||
while (c--) {
|
||||
val = stack[c][n];
|
||||
if (typeof val != 'undefined') break;
|
||||
}
|
||||
for (var i = 1, len = arguments.length; i < len; i++) {
|
||||
if (val == null) continue;
|
||||
n = arguments[i];
|
||||
val = (_hasOwnProperty.call(val, n)) ? val[n] : (typeof val._get == 'function' ? (val[n] = val._get(n)) : null);
|
||||
}
|
||||
return (val == null) ? '' : val;
|
||||
};
|
||||
var set = function (n, val) {
|
||||
stack[stack.length - 1][n] = val;
|
||||
};
|
||||
var push = function (ctx) {
|
||||
stack.push(ctx || {});
|
||||
};
|
||||
var pop = function () {
|
||||
stack.pop();
|
||||
};
|
||||
var write = function (str) {
|
||||
output.push(str);
|
||||
};
|
||||
var filter = function (val) {
|
||||
for (var i = 1, len = arguments.length; i < len; i++) {
|
||||
var arr = arguments[i], name = arr[0], filter = filters[name];
|
||||
if (filter) {
|
||||
arr[0] = val;
|
||||
//now arr looks like [val, arg1, arg2]
|
||||
val = filter.apply(data, arr);
|
||||
} else {
|
||||
throw new Error('Invalid filter: ' + name);
|
||||
}
|
||||
}
|
||||
if (opts.autoEscape && name !== opts.autoEscape && name !== 'safe') {
|
||||
//auto escape if not explicitly safe or already escaped
|
||||
val = filters[opts.autoEscape].call(data, val);
|
||||
}
|
||||
output.push(val);
|
||||
};
|
||||
var each = function (obj, loopvar, fn1, fn2) {
|
||||
if (obj == null) return;
|
||||
var arr = isArray(obj) ? obj : getKeys(obj), len = arr.length;
|
||||
var ctx = {loop: {length: len, first: arr[0], last: arr[len - 1]}};
|
||||
push(ctx);
|
||||
for (var i = 0; i < len; i++) {
|
||||
extend(ctx.loop, {index: i + 1, index0: i});
|
||||
fn1(ctx[loopvar] = arr[i]);
|
||||
}
|
||||
if (len === 0 && fn2) fn2();
|
||||
pop();
|
||||
};
|
||||
var block = function (fn) {
|
||||
push();
|
||||
fn();
|
||||
pop();
|
||||
};
|
||||
var render = function () {
|
||||
return output.join('');
|
||||
};
|
||||
data = data || {};
|
||||
opts = extend(defaults, opts || {});
|
||||
var filters = extend({
|
||||
html: function (val) {
|
||||
return toString(val)
|
||||
.split('&').join('&')
|
||||
.split('<').join('<')
|
||||
.split('>').join('>')
|
||||
.split('"').join('"');
|
||||
},
|
||||
safe: function (val) {
|
||||
return val;
|
||||
},
|
||||
toJson: function (val) {
|
||||
if (typeof val === 'object') {
|
||||
return JSON.stringify(val);
|
||||
}
|
||||
return toString(val);
|
||||
}
|
||||
}, opts.filters || {});
|
||||
var stack = [create(data || {})], output = [];
|
||||
return {
|
||||
get: get,
|
||||
set: set,
|
||||
push: push,
|
||||
pop: pop,
|
||||
write: write,
|
||||
filter: filter,
|
||||
each: each,
|
||||
block: block,
|
||||
render: render
|
||||
};
|
||||
};
|
||||
|
||||
var runtime;
|
||||
|
||||
jinja.compile = function (markup, opts) {
|
||||
opts = opts || {};
|
||||
var parser = new Parser();
|
||||
parser.readTemplateFile = this.readTemplateFile;
|
||||
var code = [];
|
||||
code.push('function render($) {');
|
||||
code.push('var get = $.get, set = $.set, push = $.push, pop = $.pop, write = $.write, filter = $.filter, each = $.each, block = $.block;');
|
||||
code.push.apply(code, parser.parse(markup));
|
||||
code.push('return $.render();');
|
||||
code.push('}');
|
||||
code = code.join('\n');
|
||||
if (opts.runtime === false) {
|
||||
var fn = new Function('data', 'options', 'return (' + code + ')(runtime(data, options))');
|
||||
} else {
|
||||
runtime = runtime || (runtime = getRuntime.toString());
|
||||
fn = new Function('data', 'options', 'return (' + code + ')((' + runtime + ')(data, options))');
|
||||
}
|
||||
return {render: fn};
|
||||
};
|
||||
|
||||
jinja.render = function (markup, data, opts) {
|
||||
var tmpl = jinja.compile(markup);
|
||||
return tmpl.render(data, opts);
|
||||
};
|
||||
|
||||
jinja.templateFiles = [];
|
||||
|
||||
jinja.readTemplateFile = function (name) {
|
||||
var templateFiles = this.templateFiles || [];
|
||||
var templateFile = templateFiles[name];
|
||||
if (templateFile == null) {
|
||||
throw new Error('Template file not found: ' + name);
|
||||
}
|
||||
return templateFile;
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
function trimLeft(str) {
|
||||
return str.replace(LEADING_SPACE, '');
|
||||
}
|
||||
|
||||
function trimRight(str) {
|
||||
return str.replace(TRAILING_SPACE, '');
|
||||
}
|
||||
|
||||
function matchAll(str, reg, fn) {
|
||||
//copy as global
|
||||
reg = new RegExp(reg.source, 'g' + (reg.ignoreCase ? 'i' : '') + (reg.multiline ? 'm' : ''));
|
||||
var match;
|
||||
while ((match = reg.exec(str))) {
|
||||
var result = fn(match[0], match.index, str);
|
||||
if (typeof result == 'number') {
|
||||
reg.lastIndex = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* 影视TV 超連結跳轉支持
|
||||
* https://t.me/fongmi_offical/
|
||||
* https://github.com/FongMi/Release/tree/main/apk
|
||||
*/
|
||||
|
||||
var rule = {
|
||||
title: '荐片',
|
||||
host: 'http://api2.rinhome.com',
|
||||
homeUrl: '/api/tag/hand?code=unknown601193cf375db73d&channel=wandoujia',//网站的首页链接,用于分类获取和推荐获取
|
||||
// url:'/api/crumb/list?area=0&category_id=fyclass&page=fypage&type=0&limit=24&fyfilter',
|
||||
url: '/api/crumb/list?page=fypage&type=0&limit=24&fyfilter',
|
||||
class_name: '全部&电影&电视剧&动漫&综艺', // 筛选 /api/term/ad_fenlei?limit=10&page=1
|
||||
class_url: '0&1&2&3&4',
|
||||
detailUrl: '/api/node/detail?channel=wandoujia&token=&id=fyid',//二级详情拼接链接(json格式用)
|
||||
searchUrl: '/api/video/search?key=**&page=fypage',
|
||||
searchable: 2,
|
||||
quickSearch: 0,
|
||||
filterable: 1,
|
||||
filter: {
|
||||
"0":[{"key":"area","name":"地區","value":[{"n":"全部","v":"0"},{"n":"国产","v":"1"},{"n":"中国香港","v":"3"},{"n":"中国台湾","v":"6"},{"n":"美国","v":"5"},{"n":"韩国","v":"18"},{"n":"日本","v":"2"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
|
||||
"1":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"1"},{"n":"首推","v":"5"},{"n":"动作","v":"6"},{"n":"喜剧","v":"7"},{"n":"战争","v":"8"},{"n":"恐怖","v":"9"},{"n":"剧情","v":"10"},{"n":"爱情","v":"11"},{"n":"科幻","v":"12"},{"n":"动画","v":"13"}]},{"key":"area","name":"地區","value":[{"n":"全部","v":"0"},{"n":"国产","v":"1"},{"n":"中国香港","v":"3"},{"n":"中国台湾","v":"6"},{"n":"美国","v":"5"},{"n":"韩国","v":"18"},{"n":"日本","v":"2"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
|
||||
"2":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"2"},{"n":"首推","v":"14"},{"n":"国产","v":"15"},{"n":"港台","v":"16"},{"n":"日韩","v":"17"},{"n":"海外","v":"18"}]},{"key":"area","name":"地區","value":[{"n":"全部","v":"0"},{"n":"国产","v":"1"},{"n":"中国香港","v":"3"},{"n":"中国台湾","v":"6"},{"n":"美国","v":"5"},{"n":"韩国","v":"18"},{"n":"日本","v":"2"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
|
||||
"3":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"3"},{"n":"首推","v":"19"},{"n":"海外","v":"20"},{"n":"日本","v":"21"},{"n":"国产","v":"22"}]},{"key":"area","name":"地區","value":[{"n":"全部","v":"0"},{"n":"国产","v":"1"},{"n":"中国香港","v":"3"},{"n":"中国台湾","v":"6"},{"n":"美国","v":"5"},{"n":"韩国","v":"18"},{"n":"日本","v":"2"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
|
||||
"4":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"4"},{"n":"首推","v":"23"},{"n":"国产","v":"24"},{"n":"海外","v":"25"},{"n":"港台","v":"26"}]},{"key":"area","name":"地區","value":[{"n":"全部","v":"0"},{"n":"国产","v":"1"},{"n":"中国香港","v":"3"},{"n":"中国台湾","v":"6"},{"n":"美国","v":"5"},{"n":"韩国","v":"18"},{"n":"日本","v":"2"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}]
|
||||
},
|
||||
filter_url: 'area={{fl.area or "0"}}&sort={{fl.sort or "update"}}&year={{fl.year or "0"}}&category_id={{fl.cateId}}',
|
||||
filter_def: {
|
||||
0:{cateId:'0'},
|
||||
1:{cateId:'1'},
|
||||
2:{cateId:'2'},
|
||||
3:{cateId:'3'},
|
||||
4:{cateId:'4'}
|
||||
},
|
||||
headers: {
|
||||
'User-Agent': 'jianpian-android/350',
|
||||
'JPAUTH': 'y261ow7kF2dtzlxh1GS9EB8nbTxNmaK/QQIAjctlKiEv'
|
||||
},
|
||||
timeout: 5000,
|
||||
limit: 8,
|
||||
play_parse: true,
|
||||
play_json: [{
|
||||
re: '*',
|
||||
json: {
|
||||
parse: 0,
|
||||
jx: 0
|
||||
}
|
||||
}],
|
||||
lazy: '',
|
||||
图片来源: '@Referer=www.jianpianapp.com@User-Agent=jianpian-version353',
|
||||
// 推荐:'json:.video;*;*;*;*',
|
||||
推荐: `js:
|
||||
var d = [];
|
||||
let html = request(input);
|
||||
html = JSON.parse(html).data[0].video;
|
||||
html.forEach(it => {
|
||||
d.push({
|
||||
title: it.title,
|
||||
img: it.path,
|
||||
desc: it.playlist.title + ' ⭐' + it.score,
|
||||
url: it.id
|
||||
})
|
||||
});
|
||||
setResult(d);
|
||||
`,
|
||||
// 一级:'json:data;title;path;playlist.title;id',
|
||||
一级: `js:
|
||||
cateObj.tid = cateObj.tid+'';
|
||||
if (cateObj.tid.endsWith('_clicklink')) {
|
||||
cateObj.tid = cateObj.tid.split('_')[0];
|
||||
input = HOST + '/api/video/search?key=' + cateObj.tid + '&page=' + + MY_PAGE;
|
||||
}
|
||||
var d = [];
|
||||
let html = request(input);
|
||||
html = JSON.parse(html).data;
|
||||
html.forEach(it => {
|
||||
d.push({
|
||||
title: it.title,
|
||||
img: it.thumbnail||it.path,
|
||||
desc: (it.mask || it.playlist.title) + ' ⭐' + it.score,
|
||||
url: it.id
|
||||
})
|
||||
});
|
||||
setResult(d);
|
||||
`,
|
||||
二级: `js:
|
||||
function getLink(data) {
|
||||
let link = data.map(it => {
|
||||
return '[a=cr:' + JSON.stringify({'id':it.name+'_clicklink','name':it.name}) + '/]' + it.name + '[/a]'
|
||||
}).join(', ');
|
||||
return link
|
||||
}
|
||||
try {
|
||||
let html = request(input);
|
||||
html = JSON.parse(html);
|
||||
let node = html.data;
|
||||
VOD = {
|
||||
vod_id: node.id,
|
||||
vod_name: node.title,
|
||||
vod_pic: node.thumbnail,
|
||||
type_name: node.types[0].name,
|
||||
vod_year: node.year.title,
|
||||
vod_area: node.area.title,
|
||||
vod_remarks: node.score,
|
||||
vod_actor: getLink(node.actors),
|
||||
vod_director: getLink(node.directors),
|
||||
vod_content: node.description.strip()
|
||||
};
|
||||
if (typeof play_url === 'undefined') {
|
||||
var play_url = ''
|
||||
}
|
||||
let playMap = {};
|
||||
if (node.have_ftp_ur == 1) {
|
||||
playMap["边下边播,勤去清缓存"] = node.new_ftp_list.map(it => {
|
||||
return it.title + "$" + (/m3u8/.test(it.url) ? play_url + it.url : "tvbox-xg:" + it.url)
|
||||
}).join('#');
|
||||
}
|
||||
if (node.have_m3u8_ur == 1) {
|
||||
playMap["在线点播普清版"] = node.new_m3u8_list.map(it => {
|
||||
return it.title + "$" + (/m3u8/.test(it.url) ? play_url + it.url : "tvbox-xg:" + it.url)
|
||||
}).join('#');
|
||||
}
|
||||
let playFrom = [];
|
||||
let playList = [];
|
||||
Object.keys(playMap).forEach(key => {
|
||||
playFrom.append(key);
|
||||
playList.append(playMap[key])
|
||||
});
|
||||
VOD.vod_play_from = playFrom.join('$$$');
|
||||
VOD.vod_play_url = playList.join('$$$');
|
||||
} catch (e) {
|
||||
log("获取二级详情页发生错误:" + e.message);
|
||||
}
|
||||
`,
|
||||
// 搜索:'json:data;*;thumbnail;mask;*',
|
||||
搜索: `js:
|
||||
var d = [];
|
||||
let html = request(input);
|
||||
html = JSON.parse(html).data;
|
||||
html.forEach(it => {
|
||||
d.push({
|
||||
title: it.title,
|
||||
img: it.thumbnail,
|
||||
desc: it.mask + ' ⭐' + it.score,
|
||||
url: it.id
|
||||
})
|
||||
});
|
||||
setResult(d);
|
||||
`,
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
qz2VfkB3O9fqiff5MjJa/ASdotKRYPNu8cLtwdABO3MDeyNp8SITwKEVrcmMRsD6s0DQiKXK91uXHy81Bhzh8xPZzDl/A9cOXQrBxH+Qn2Zl2eNL3Ogzx+kAqZMq7TDGW7Ndfho+4VAcQyAx6N07mJYHA4x94WwszBgxbsp7GcesErxMHMjHWXdbImOCfpVcqeg26DzBb3cpa28wYefQF2s+fbNlwlWJeQnLBSLuK1wKAMahZyys0ERilTj+fvCQ8zuZJVbNUihk76uwf3UQavFn1W7Yibs4uOA38Dj51sLDEiJ1PqwXYzqROsYmoyDpdY1sJaRwR7x0BaXYmWdOEh7L0Vhceq2evj8POwVz8IDWoWtid/DbhgheQm7605g96VV+C4FGYtYWcJ65Nj1XPiFWIRVgDVkkHHRXheO41qBtS/avLHDaCR7MTTGqg2cB0iYCKDum7FHVREC0obqjy/6p98w16Q87B0LE3ZT1VcAKVqaq9eN4bDH3Q0SPWx2h0MdMQM40iWh+BPIBGL91D1e2cQTz6fNAJRhN4k4t2rHv+6JIhzke1ABiy2JPzZvlcNJmpcZZASG/0iFtBscSaXEmplHb+7F1uwhM+Dof6ygZ857d7WdlpBEMF+MkiZfZ8jUfHr4xbdK/fjHBvAbLntFiaVQuoTWtwFOJvK2Z9EImQQKcrcGsgvK6ciouPOndiWdWXB/uhkekWBgSSqFRkmgPfjl8D55qxTHrK10Y6/Ba5c7JXte02gYYYmN8dC2wiqN63S3ss4Q7BBQHpIIz7vnBFgu1SW+ArR4YOpm4KVU/h3CaghPa1hj7k/VSyVy5eWrzH/r5F+VZgIxyhhOyOQjv+QuvRwJUsWDo8/v31c9qQMKFpREllODOPa8O8fBqVS/zaeYjSqLbIssLQyk9VdgIvvWZwroiussZfvYYcrzQy0dzR3/YhSQZEsIzFYNr0A5+E2xypU1JJ6L7H8fvoM7aLM5XlSIiRhB5NVfBrVtUZV7TC61pn4zVet55VnPbGzGMJ+AZxlaqj6BKiFCEmSkELk1OUY/g2oEGmDHNvBJbNzBYfHhUopYtfjGwWRavramw1nau28VDNn3eDjZQzFFFspx/TFeZJEj0mUfIsQlVlFHPct0q0o9aDe0E+mbVFLervzMiL6lCqp5LNQuDmABtzgPUKI+tnJDsawN1ooRxJVXGtdbse96sfMv2uHkd6S4lYx7m7QoS8Sj5BnW/iZyIKegaBS9pGTTLxfJ1BTF3A45/r7P9kDKhlx4/hoNkz/WSNlYP+KWuM0ljZ5pRnvrTMEIrOrfd6ngQMr0+uhqVdWJtkriSCGCttddxdAtl8V/K69rFaI27RYKSrW73H4sEz9sbQ+Fj9k8NvutV75ojXdxncNqLyAbf9uTd1T0sKK/s9+8/MPRR/EUH7GA8VsGux9poJKPuxhNDuFVCdZdWEfs5Qx7ZNc+1YYbIe5qUofNHW6g8Y7vVZj6DaFzx+2pdvmrABXQZyILxs+oiCd2bAKXR/pkBWFbe2jiSTJviSyq7/6y0qBR0Rc9moINlCbs0Znmab2GMtiaUYKWaT0LZJdws29r54AA9NHvpQZJua83Tei7Xu683zalMzXNhX7iFlbYDHU1iNJIVVnUqYO042/8UObnpGNa8uWW8e4ejJ/rM6jNDy+ELyV3b25p42IOiWyFm0/kS7HOM9DLPmk3qb/tUJsgzLnTuNGl1QcyZ
|
||||
@@ -0,0 +1,5 @@
|
||||
var rule={title:"斗鱼直播",host:"https://m.douyu.com",homeUrl:"/api/home/mix",url:"/api/room/list?page=fypage&type=fyfilter",filterable:1,filter_url:"{{fl.cateId}}",filter:{yl:[{key:"cateId",name:"分类",value:[{n:"原创IP",v:"ip"},{n:"一起看",v:"yqk"},{n:"二次元",v:"ecy"},{n:"音乐",v:"music"},{n:"户外",v:"HW"},{n:"美食",v:"ms"},{n:"心动派对",v:"xdpd"},{n:"音遇恋人",v:"yinyu"},{n:"星秀",v:"xingxiu"},{n:"心动FM",v:"dtxs"},{n:"娱乐推荐",v:"yltj"},{n:"新选",v:"xinxuan"}]}],PCgame:[{key:"cateId",name:"分类",value:[{n:"英雄联盟",v:"LOL"},{n:"热门游戏",v:"rmyx"},{n:"穿越火线",v:"CF"},{n:"重生边缘",v:"CSBYOL"},{n:"无畏契约",v:"VALORANT"},{n:"CFHD",v:"CFHD"},{n:"命运方舟",v:"LostArk"},{n:"DNF",v:"DNF"},{n:"DOTA2",v:"DOTA2"},{n:"使命召唤",v:"COD"},{n:"炉石传说",v:"How"},{n:"CS2",v:"CounterStrike"},{n:"lol云顶之弈",v:"ydzhy"},{n:"魔兽争霸",v:"mszb"},{n:"魔兽怀旧服",v:"wowclassic"},{n:"全民街篮",v:"qmjl"},{n:"自走棋",v:"dota2rpg"},{n:"传奇",v:"cq"},{n:"跑跑卡丁车",v:"Popkart"},{n:"网易游戏",v:"wyyx"},{n:"星际争霸",v:"SC"},{n:"守望先锋",v:"Overwatch"},{n:"DOTA",v:"DOTA"},{n:"魔兽世界",v:"WOW"},{n:"剑网3",v:"JX3"},{n:"魔域",v:"EudemonsOnline"},{n:"我的世界",v:"MC"},{n:"超激斗梦境",v:"cjdmj"},{n:"冒险岛",v:"mxd"},{n:"三国杀",v:"sanguosha"},{n:"梦幻西游",v:"MHXYOL"},{n:"天涯明月刀",v:"tianya"},{n:"街头篮球",v:"jtlq"},{n:"NBA2KOL2",v:"NBA2KOL2"},{n:"QQ飞车端游",v:"qqfcdy"},{n:"战地之王",v:"AVA"},{n:"军事游戏",v:"jsyx"},{n:"棋牌娱乐",v:"qipai"},{n:"FC ONLINE",v:"FCOL"},{n:"热门网游",v:"rmwy"},{n:"卡拉彼丘",v:"klbq"},{n:"诛仙世界",v:"zxsj"},{n:"千古风流",v:"qgflpc"},{n:"APEX",v:"APEX"},{n:"流放之路POE",v:"PathofExile"},{n:"剑网3缘起",v:"JW3YQ"},{n:"逆水寒",v:"nsh"},{n:"风暴英雄",v:"HOTS"},{n:"逆战",v:"NZ"},{n:"坦克世界",v:"TKSJ"},{n:"战舰世界",v:"wfws"},{n:"巫师之昆特牌",v:"wszktp"},{n:"反恐精英Online",v:"CS"},{n:"暗黑破坏神",v:"DIABLO"},{n:"梦三国2",v:"msg2"},{n:"传奇世界",v:"cqsj"},{n:"方舟:生存进化",v:"fzscjh"},{n:"神武4电脑版",v:"swdnb"},{n:"群雄逐鹿",v:"qxzl"},{n:"堡垒之夜",v:"blzy"},{n:"无限法则",v:"roe"},{n:"问道电脑版",v:"wddnb"},{n:"西山居游戏",v:"Seasun"},{n:"最终幻想14",v:"FF14"},{n:"战意",v:"WYZY"},{n:"剑灵",v:"BladeSoul"},{n:"星际战甲",v:"Warframe"},{n:"龙之谷",v:"DragonNest"},{n:"铁甲雄兵",v:"tjxb"},{n:"古剑奇谭网络版",v:"gjqtwlb"},{n:"轩辕传奇",v:"XYCQ"},{n:"神途",v:"shentu"},{n:"激战2",v:"GuildWars2"},{n:"高达文化区",v:"gdyxq"},{n:"忍者村大战2",v:"rzcdz2"},{n:"RPG网游专区",v:"rpgwyzq"},{n:"诛仙3",v:"zhuxian3"},{n:"笑傲江湖OL",v:"xajhol"},{n:"冒险岛2",v:"MXD2"},{n:"超击突破",v:"SuperPeople"},{n:"无尽战区",v:"WJZQ"},{n:"斗战神",v:"dzs"},{n:"永恒之塔",v:"AION"},{n:"九阴真经",v:"JYZJ"},{n:"FPS综合网游",v:"FPSOL"},{n:"劲舞团",v:"jwt"},{n:"天下",v:"tianxai"},{n:"泡泡堂",v:"ppt"},{n:"武侠乂",v:"wxy"},{n:"音乐游戏",v:"MG"},{n:"新倩女幽魂",v:"ONLINE"},{n:"天谕",v:"tianyu"},{n:"征途2",v:"zhengtu2"},{n:"QQ炫舞",v:"qqxw"},{n:"泰亚史诗",v:"tyss"},{n:"怪物猎人ol",v:"MHol"},{n:"手工星球",v:"sgxq"},{n:"星战前夜:晨曦",v:"EVE"},{n:"热血传奇:本源",v:"rxcqhjsgb"},{n:"枪火重生",v:"qhcs"},{n:"彩虹岛",v:"CHD"},{n:"御龙在天",v:"YLZT"},{n:"英魂之刃",v:"YHZR"},{n:"自由篮球",v:"ZYLQ"},{n:"洛奇英雄传",v:"LQYXZ"},{n:"封印者",v:"FYZ"},{n:"合金弹头",v:"HJDT"},{n:"新英雄年代",v:"XYXSD"},{n:"星尘传说",v:"XCCS"},{n:"盛趣游戏",v:"SQYX"},{n:"新热血英豪",v:"XRXYH"},{n:"沙盒游戏",v:"SHYX"},{n:"我的世界:地下城",v:"MD"},{n:"恐鬼症",v:"KGZ"},{n:"领地人生",v:"LDRS"},{n:"梦塔防",v:"TDOTK"},{n:"大话西游2",v:"dhxy2"},{n:"猎人",v:"lr"},{n:"热血江湖online",v:"rxjhol"},{n:"千年3",v:"qn3"},{n:"逍遥情缘",v:"xyqy"},{n:"快乐西游",v:"klxy"},{n:"鹿鼎记",v:"ldj"},{n:"新桃花源记",v:"xthyj"},{n:"疾风之刃电脑版",v:"jfzr1"},{n:"武魂2电脑版",v:"wh2pc"},{n:"奇迹世界sun",v:"qjsjsun"},{n:"剑侠世界2电脑版",v:"jxsj2pc"},{n:"斩魂",v:"zhpc"},{n:"大唐2",v:"dt2pc"},{n:"蜀山:初章",v:"ssczpc"},{n:"狼人对决网游",v:"lrdjpc"},{n:"武林群侠传",v:"wlqxzpc"},{n:"飘流幻境",v:"plhjpc"},{n:"破天一剑",v:"ptyj"},{n:"四国军棋",v:"sgjq"},{n:"新大话西游3",v:"xy3"},{n:"装甲战争",v:"zjzz"},{n:"暴雪游戏综合",v:"g_bliz"},{n:"长尾4部虚拟分区",v:"cw4bxnfq"},{n:"燕云十六声",v:"WHEREWINDSMEET"},{n:"THE FINALS",v:"THEFINALS"},{n:"NBA2K Online",v:"NBA2KOL"},{n:"塔瑞斯世界",v:"Tarisland"},{n:"跑跑卡丁车:漂移",v:"KartRiderDrift"},{n:"传奇永恒",v:"EternalLegend"},{n:"全境封锁2",v:"TheDivision2"},{n:"盛趣传奇",v:"sqcq"},{n:"火爆热游",v:"hbry"},{n:"火爆传奇",v:"hbcq"}]}],djry:[{key:"cateId",name:"分类",value:[{n:"主机游戏",v:"TVgame"},{n:"刺客信条:英灵殿",v:"AC"},{n:"马里奥制造",v:"Mario"},{n:"逃离塔科夫",v:"EFT"},{n:"命运2",v:"MY2"},{n:"恐怖游戏",v:"Horror"},{n:"荒野大镖客",v:"hydbk"},{n:"灵魂筹码",v:"lhcm"},{n:"骑马与砍杀",v:"MountAndBlade"},{n:"只狼",v:"ZL"},{n:"格斗游戏",v:"FTG"},{n:"饥荒",v:"DontStarve"},{n:"全境封锁",v:"qjfs"},{n:"怀旧游戏",v:"classic"},{n:"NBA2K",v:"NBA2K"},{n:"八方旅人",v:"OT"},{n:"血污:夜之仪式",v:"Blood"},{n:"人类一败涂地",v:"Human"},{n:"环世界",v:"RimWorld"},{n:"古墓丽影",v:"gmly"},{n:"鬼泣",v:"DMC"},{n:"往日不再",v:"WRBZ"},{n:"仙剑奇侠传",v:"PAL"},{n:"神秘海域",v:"Uncharted"},{n:"塞尔达系列",v:"TLoZ"},{n:"僵尸世界大战",v:"WWZ"},{n:"足球游戏",v:"zq"},{n:"橙光",v:"cg"},{n:"了不起的修仙模拟器",v:"ACS"},{n:"女神异闻录",v:"P5"},{n:"超级马里奥",v:"SMO"},{n:"三国志系列",v:"Sangokushi"},{n:"最终幻想",v:"FF"},{n:"中土世界:战争之影",v:"MiddleEarth"},{n:"流放者柯南",v:"Conan"},{n:"三国群英传",v:"SANGO"},{n:"无主之地",v:"Bor"},{n:"辐射",v:"fs"},{n:"SCUM",v:"Scum"},{n:"文明",v:"CVI"},{n:"仁王",v:"NIOH"},{n:"缺氧",v:"ONI"},{n:"全面吃鸡模拟器",v:"TAB"},{n:"古剑奇谭",v:"GuJian3"},{n:"皇牌空战",v:"hpkz"},{n:"体育游戏",v:"tyyx"},{n:"海岛大亨",v:"hddh"},{n:"碧海黑帆",v:"klhdt"},{n:"植物大战僵尸:花园战争系列",v:"PvsZ"},{n:"蜘蛛侠",v:"Spide"},{n:"勇者斗恶龙:建造者2",v:"DQB2"},{n:"遗迹:灰烬重生",v:"Rem"},{n:"血源",v:"BB"},{n:"旺达与巨像",v:"SotC"},{n:"死亡搁浅",v:"DS"},{n:"模拟人生",v:"Sims"},{n:"空洞骑士",v:"HKS"},{n:"胡闹厨房",v:"Overcooked"},{n:"地铁:离去",v:"ME"},{n:"生死狙击2",v:"ssjjtwo"},{n:"三国战纪",v:"sgzj"},{n:"怀旧FC",v:"edwcy"},{n:"经典单机",v:"jddj"},{n:"英雄无敌",v:"HoMM"},{n:"街机游戏",v:"jjyx"},{n:"合金装备",v:"MetalGear"},{n:"红色警戒",v:"hsjj"},{n:"镜之边缘",v:"MsE"},{n:"勿忘我",v:"Remw"},{n:"火焰纹章系列",v:"FireEmblem"},{n:"星露谷物语",v:"Stardew"},{n:"火炬之光",v:"Torchlight"},{n:"赛博朋克2077",v:"Cyberpunk"},{n:"中国式家长",v:"CP"},{n:"精灵宝可梦系列",v:"Pokemon"},{n:"尼尔:机械纪元",v:"NieR"},{n:"无人深空",v:"NMS"},{n:"EVOTINCTION",v:"EVOTINCTION"},{n:"GT赛车7",v:"GT"},{n:"超级机器人大战",v:"SRW"},{n:"这是我的战争",v:"TWoM"},{n:"杀戮尖塔",v:"sljt"},{n:"冰汽时代",v:"Frostpunk"},{n:"帝国时代",v:"AoEIV"},{n:"死亡空间",v:"swkj"},{n:"凯瑟琳Full Body",v:"CFB"},{n:"足球经理",v:"Football"},{n:"雨中冒险",v:"RoR"},{n:"亿万僵尸",v:"Billions"},{n:"武装突袭",v:"ArmA"},{n:"石油大亨",v:"Oil"},{n:"欧洲卡车模拟器",v:"Truck"},{n:"美国逃亡者",v:"Fugitive"},{n:"漫漫长夜",v:"mmcy"},{n:"永恒轮回",v:"Survival"},{n:"孤岛惊魂",v:"FarCry"},{n:"都市:天际线",v:"Skylines"},{n:"盗贼之海",v:"hdzh"},{n:"Dayz",v:"DayZ"},{n:"60秒",v:"60S"},{n:"俄罗斯钓鱼",v:"RF"},{n:"猎人:荒野的召唤",v:"theHunter"},{n:"恐怖黎明",v:"GD"},{n:"看门狗",v:"kmg"},{n:"真三国无双",v:"DW"},{n:"战斗砖块剧场",v:"BT"},{n:"泰拉瑞亚",v:"Terraria"},{n:"异星工厂",v:"Factorio"},{n:"UFC",v:"UFC"},{n:"底特律:变人",v:"Detroit"},{n:"恶魔城",v:"Castlevania"},{n:"毁灭战士",v:"Doom"},{n:"火影忍者:究极忍者风暴",v:"Naruto"},{n:"坎巴拉太空计划",v:"Kerbal"},{n:"龙珠:超宇宙",v:"DBX"},{n:"马里奥赛车",v:"MarioKart"},{n:"欧陆风云",v:"EU"},{n:"乞丐模拟器",v:"HoboToughLife"},{n:"小偷模拟器",v:"ThiefSimulator"},{n:"逆转裁判",v:"AceA"},{n:"超越光速",v:"FTL"},{n:"植物大战僵尸",v:"PvZ"},{n:"游戏开发者",v:"GGM"},{n:"最后的绿洲",v:"LO"},{n:"大富翁",v:"RichMan"},{n:"反恐精英",v:"fkjy"},{n:"英雄连",v:"yxl"},{n:"永劫无间",v:"NB"},{n:"初音未来:歌姬计划",v:"MIKU"},{n:"部落与弯刀",v:"BLYWD"},{n:"一起开火车!",v:"Unrailed"},{n:"霓虹深渊",v:"NA"},{n:"主机其他游戏",v:"OG"},{n:"战场兄弟",v:"ZCXD"},{n:"地狱潜者",v:"DYQZ"},{n:"地下城",v:"dxc"},{n:"人间地狱",v:"RJDY"},{n:"temtem",v:"temtem"},{n:"弹丸论破",v:"dwlp"},{n:"皇家美食",v:"HJMS"},{n:"基佬大乱斗",v:"jldld"},{n:"僵尸毁灭工程",v:"jshmgc"},{n:"岛屿生存者",v:"Sur"},{n:"冬日计划",v:"drjh"},{n:"四海兄弟",v:"shxd"},{n:"创世理想乡",v:"Craftopia"},{n:"柯娜:精神之桥",v:"Kena"},{n:"幽灵线:东京",v:"GTO"},{n:"Solar Ash",v:"Ash"},{n:"BUGSNAX",v:"BUGSNAX"},{n:"生化危机4重制版",v:"ResidentEvil"},{n:"Grounded",v:"Grounded"},{n:"Superliminal",v:"Superliminal"},{n:"Omno",v:"Omno"},{n:"Röki",v:"Roki"},{n:"Undungeon",v:"Undungeon"},{n:"糖豆人",v:"FallGuys"},{n:"渡神纪",v:"Gods"},{n:"Aeolis Tournament",v:"Aeolis"},{n:"猛兽派对",v:"Animals"},{n:"Olija",v:"Olija"},{n:"Creaks",v:"Creaks"},{n:"暗影火炬城",v:"FIST"},{n:"阿尔比恩",v:"Albion"},{n:"Uragun",v:"Uragun"},{n:"戴森球计划",v:"DSP"},{n:"Muse Dash",v:"MuseDash"},{n:"恐惧之间",v:"Fearsurrounds"},{n:"孤岛惊魂6",v:"FarCry6"},{n:"怪物猎人",v:"MonsterHunterRise"},{n:"黑神话:悟空",v:"BlackMythWuKong"},{n:"仁王2",v:"Nioh2"},{n:"三国群英传8",v:"TheThreeKingdoms8"},{n:"三国志14",v:"THREEKINGDOMSXIV"},{n:"杀手3",v:"Hitman3"},{n:"双人成行",v:"ittakestwo"},{n:"Scrapnaut",v:"Scrapnaut"},{n:"租房达人",v:"TheTenants"},{n:"狙击手:幽灵战士契约2",v:"SniperContracts2"},{n:"全面战争",v:"TotalWarWARHAMMER"},{n:"复体",v:"TheComplex"},{n:"战争机器:战术小队",v:"GearsTactics"},{n:"海绵宝宝:比奇堡的冒险",v:"BattleforBikini"},{n:"分离",v:"Disintegration"},{n:"奇妙探险队2",v:"CuriousExpedition2"},{n:"刺客信条:奥德赛",v:"Odyssey"},{n:"丧尸围城4",v:"DeadRising4"},{n:"星球大战:前线",v:"Battlefront"},{n:"Moonray",v:"Moonray"},{n:"灵魂旅人",v:"SpiritFarerlhlr"},{n:"面容",v:"Visage"},{n:"车祸现场模拟器",v:"Accident"},{n:"破门而入2:北方特遣队",v:"DoorKickers2"},{n:"俄罗斯方块效应:连接",v:"TetrisEffect"},{n:"SD高达G世纪:起源",v:"SDGundamG"},{n:"东方计划:不可思议的幻想乡",v:"TouHou"},{n:"Fate/EXTELLA",v:"FateEXTELLA"},{n:"临终:重生试炼",v:"DYINGReborn"},{n:"虚拟现实乐园",v:"VRWorlds"},{n:"苍翼默示录:神观之梦",v:"CentralFiction"},{n:"晚班",v:"LateShift"},{n:"子弹风暴",v:"Bulletstorm"},{n:"巡警",v:"BeatCop"},{n:"耻辱之日",v:"DayofInfamy"},{n:"狙击精英4",v:"SniperElite4"},{n:"热血物语:地下世界",v:"RiverCityRansom"},{n:"史诗战争模拟器",v:"BattleSimulator"},{n:"银河护卫队",v:"Guardians"},{n:"上古卷轴:传奇",v:"ScrollsLegends"},{n:"闪乱神乐:少女们的选择",v:"SenranKagura"},{n:"幽灵行动:荒野",v:"GhostReconWildland"},{n:"白色情人节",v:"WhiteDay"},{n:"誓死坚守",v:"UntilWeDie"},{n:"狂战传说",v:"TalesofBerseria"},{n:"双截龙4",v:"DoubleDragon4"},{n:"地下蚁国",v:"Undergrowth"},{n:"寻找天堂",v:"findparadise"},{n:"画中世界",v:"Gorogoa"},{n:"现代战争",v:"ModernCombat"},{n:"绯红结系",v:"SCARLETNEXUS"},{n:"罪恶装备:STRIVE",v:"GuiltyGear"},{n:"涅克罗蒙达:赏金猎人",v:"NHiredGun"},{n:"骑士精神2",v:"Chivalry2"},{n:"Rune Knights",v:"RuneKnights"},{n:"红至日2:幸存者",v:"TheRed2"},{n:"真女神转生3",v:"ShinMegami3"},{n:"速降王者",v:"Descenders"},{n:"工业崛起",v:"RiseIndustry"},{n:"前往中世纪",v:"GoMedieval"},{n:"Arid",v:"Arid"},{n:"伊始之地",v:"TerraNil"},{n:"进击的巨人2",v:"AttackonTitan2"},{n:"魔域之书",v:"Bookofdevil"},{n:"自由人:游击战争",v:"Freeman"},{n:"战国无双5",v:"SWarriors5"},{n:"不要喂食猴子",v:"NotFeedMonkeys"},{n:"古剑奇谭3",v:"GuJianqitan3"},{n:"剑士",v:"KenshiJS"},{n:"GRIS",v:"GRIS"},{n:"古剑奇谭:永夜",v:"gujianyongye"},{n:"永恒边缘",v:"EdgeEternity"},{n:"Below",v:"Below"},{n:"彩虹坠入",v:"IrisFall"},{n:"嗜血印",v:"BloodySpell"},{n:"兽人必须死3",v:"OrcsDie3"},{n:"狙击精英VR",v:"SniperEliteVR"},{n:"遗忘之城",v:"ForgotCity"},{n:"Last Stop",v:"LastStop"},{n:"边界之外",v:"OutofLine"},{n:"从军",v:"jointhearmy"},{n:"石炉",v:"Stonehearth"},{n:"狂热运输2",v:"TransportFever2"},{n:"机甲战士5",v:"MechWarrior5"},{n:"PICO PARK",v:"PICOPARK"},{n:"光明记忆:无限",v:"Brightmemory"},{n:"秘馆疑踪",v:"HeavenDust"},{n:"侠盗公司",v:"RogueCompany"},{n:"英雄传说:创之轨迹",v:"HajimariNOKiseki"},{n:"战地系列",v:"Battlefiel"},{n:"塞尔达传说:天空之剑HD",v:"SkywardSword"},{n:"尘埃异变",v:"GRIME"},{n:"异形:火力小队精英",v:"FireteamElite"},{n:"12分钟",v:"TwelveMinutes"},{n:"九十六号公路",v:"Road96"},{n:"FORECLOSED",v:"FORECLOSED"},{n:"RiMS Racing",v:"RiMSRacing"},{n:"钢铁之尾",v:"TailsofIron"},{n:"剑侠图",v:"JianXiaTu"},{n:"审判之逝",v:"Lostjudgment"},{n:"帝国神话",v:"mythofempires"},{n:"艾尔登法环",v:"ELDENRING"},{n:"极限竞速:地平线5",v:"ForzaHorizon5"},{n:"使命召唤系列",v:"CALLOFDUTYCOD"},{n:"网吧模拟器",v:"InternetCS"},{n:"The Anacrusis",v:"TheAnacrusis"},{n:"浩劫前夕",v:"TheDayBefore"},{n:"文字游戏",v:"WordGame"},{n:"消逝的光芒2",v:"DyingLight2"},{n:"无主之地3",v:"Borderlands3"},{n:"战神:诸神黄昏",v:"GodofWarRagnarok"},{n:"海上狼人杀",v:"DreadHunger"},{n:"侠乂行:浪迹天涯",v:"XIAYIXING"},{n:"最终幻想:起源",v:"STRANGEROFPARADISE"},{n:"HordeCore",v:"HordeCore"},{n:"双子星:盛气凌人",v:"YoungSouls"},{n:"Indies’ Lies",v:"IndiesLies"},{n:"Deck of Ashes",v:"DeckofAshes"},{n:"星空",v:"Starfield"},{n:"Ilysia",v:"Ilysia"},{n:"Project Q",v:"ProjectQ"},{n:"Pummel Party",v:"PummelParty"},{n:"Holomento",v:"Holomento"},{n:"Overprime",v:"Overprime"},{n:"森林之子",v:"SonsOfTheForest"},{n:"弈仙牌",v:"yixianpai"},{n:"夜族崛起",v:"VRising"},{n:"罗马复兴",v:"RomanRenaissance"},{n:"萤火突击",v:"LostLight"},{n:"High on Life",v:"HighonLife"},{n:"匹诺曹的谎言",v:"LiesofP"},{n:"Isonzo",v:"Isonzo"},{n:"瘟疫传说:安魂曲",v:"Requiem"},{n:"漂泊牧歌",v:"WanderingVillage"},{n:"塞尔达传说:王国之泪",v:"TEARSKINGDOM"},{n:"破碎线",v:"Shatterline"},{n:"卧龙:苍天陨落",v:"Wolong"},{n:"卡库远古封印",v:"KAKU"},{n:"原子之心",v:"AtomicHeart"},{n:"Warhaven",v:"Warhaven"},{n:"宝可梦:朱/紫",v:"ScarletandViolet"},{n:"Evercore Heroes",v:"EvercoreHeroes"},{n:"灵魂石幸存者",v:"SoulstoneSurvivors"},{n:"主机一起看",v:"zjyqk"},{n:"社交互动游戏",v:"SJHDYX"},{n:"轮回修仙路",v:"lhxxl"},{n:"Divine Knockout",v:"DivineKnockout"},{n:"至暗时刻",v:"DarkandDarker"},{n:"自杀小队:杀死正义联盟",v:"KTJL"},{n:"XDefiant",v:"XDefiant"},{n:"Warlander",v:"Warlander"},{n:"Scars Above",v:"ScarsAbove"},{n:"Pacific Drive",v:"PacificDrive"},{n:"最终幻想16",v:"FinalFantasyXVI"},{n:"街头霸王",v:"StreetFighter"},{n:"Tchia",v:"Tchia"},{n:"大侠立志传",v:"HerosAdventure"},{n:"最后纪元",v:"LastEpoch"},{n:"魔戒:咕噜",v:"Gollum"},{n:"Prison Life 2",v:"PrisonLife"},{n:"Innchanted",v:"Innchanted"},{n:"幻兽帕鲁",v:"Palworld"},{n:"Life by You",v:"LifebyYou"},{n:"Eresys",v:"Eresys"},{n:"Pax Dei",v:"PaxDei"},{n:"Teravit",v:"Teravit"},{n:"Caliber",v:"Caliber"},{n:"沙盒与副本:英勇之地",v:"HerosLand"},{n:"Coridden",v:"Coridden"},{n:"Unrecord",v:"Unrecord"},{n:"Deducto 2",v:"Deducto2"},{n:"装甲核心6:境界天火",v:"ArmoredCore"},{n:"Wayfinder",v:"Wayfinder"},{n:"迷瘴纪事",v:"MiasmaChronicles"},{n:"Minigame Madness",v:"MinigameMadness"},{n:"严阵以待",v:"ReadyorNot"},{n:"上古卷轴OL",v:"TheElderScrolls"},{n:"弹幕风暴",v:"dmfb"},{n:"学园构想家",v:"SchoolHomeroom"},{n:"弈仙牌手游",v:"YiXianm"},{n:"Jusant",v:"JUSANT"},{n:"潜水员戴夫",v:"DAVETHEDIVER"},{n:"GYLT",v:"GYLT"},{n:"索利斯堡",v:"FortSolis"},{n:"Towerborne",v:"Towerborne"},{n:"33 Immortals",v:"33Immortals"},{n:"Wildmender",v:"Wildmender"},{n:"How 2 Escape",v:"How2Escape"},{n:"碧蓝幻想:Relink",v:"Relink"},{n:"漫威蜘蛛侠2",v:"MarvelSpiderman2"},{n:"王权与自由",v:"ThroneandLiberty"},{n:"博德之门3",v:"BG3"},{n:"Eternights",v:"Eternights"},{n:"Project F",v:"ProjectF"},{n:"BaldMan Climbs Up",v:"BaldManClimbsUp"},{n:"FC24",v:"FC24"},{n:"NBA 2K24",v:"NBA2K24"},{n:"沉没之地",v:"Sunkenland"},{n:"七日世界",v:"qrsj"},{n:"雾锁王国",v:"wswg"}]}],syxx:[{key:"cateId",name:"分类",value:[{n:"元梦之星",v:"YMZX"},{n:"王者荣耀",v:"wzry"},{n:"LOL手游",v:"LOLM"},{n:"崩坏:星穹铁道",v:"bhxqtd"},{n:"和平精英",v:"hpjy"},{n:"暗区突围",v:"aqtw"},{n:"蛋仔派对",v:"dzpd"},{n:"高能英雄",v:"gnyx"},{n:"幻塔",v:"ht"},{n:"火影忍者",v:"hyrz"},{n:"COD手游",v:"smzhsy"},{n:"lol电竞经理",v:"EGAME"},{n:"DNF手游",v:"mdnf"},{n:"金铲铲之战",v:"JGAME"},{n:"天刀手游",v:"tdsy"},{n:"原神",v:"yuanshen"},{n:"航海王热血航线",v:"HHWRXHX"},{n:"逆水寒手游",v:"NSHM"},{n:"万国觉醒",v:"wgjx"},{n:"鸿图之下",v:"htzx"},{n:"欢乐麻将",v:"HLMJ"},{n:"王者模拟战",v:"wzrpg"},{n:"中国象棋",v:"ZGXQ"},{n:"天谕手游",v:"tysy"},{n:"巅峰坦克",v:"DFTK"},{n:"新游中心",v:"xyzx"},{n:"热门手游",v:"phone"},{n:"梦幻手游",v:"mhxy"},{n:"QQ飞车",v:"qqfcsy"},{n:"第五人格",v:"dwrg"},{n:"欢乐斗地主",v:"hlddz"},{n:"荒野乱斗",v:"hyld"},{n:"阴阳师",v:"yys"},{n:"狼人杀",v:"LRS"},{n:"JJ斗地主",v:"jj"},{n:"梦幻新诛仙",v:"mhxzx"},{n:"街霸对决",v:"jbdj"},{n:"机动都市阿尔法",v:"jddsaef"},{n:"一人之下",v:"yrzx"},{n:"多多自走棋",v:"zzq"},{n:"崩坏3",v:"bhxl"},{n:"风云岛行动",v:"fydxd"},{n:"云游戏",v:"cloudgame"},{n:"跑跑手游",v:"PPKDCSY"},{n:"率土之滨",v:"stzb"},{n:"灌篮高手",v:"glgs"},{n:"皇室战争",v:"hszz"},{n:"忍者必须死3",v:"rzbxs3"},{n:"神武4手游",v:"sw3"},{n:"梦幻模拟战",v:"mhmnz"},{n:"实况足球",v:"skzq"},{n:"剑与远征",v:"jyyz"},{n:"航海王:燃烧意志",v:"hhwrsyz"},{n:"球球大作战",v:"qqdzz"},{n:"英雄杀",v:"yxs"},{n:"魔域口袋版",v:"mykdb"},{n:"口袋新旅程",v:"KDXLC"},{n:"剑网3:指尖江湖",v:"jw3zjjh"},{n:"部落冲突",v:"blct"},{n:"剑与家园",v:"jyjy"},{n:"新笑傲江湖",v:"xxajh"},{n:"猫和老鼠",v:"mhls"},{n:"猎人手游",v:"lrlr"},{n:"明日之后",v:"mrzh"},{n:"影之诗",v:"yzs"},{n:"决战平安京",v:"jzpaj"},{n:"魂斗罗归来",v:"DLHGL"},{n:"贪吃蛇大作战",v:"tcsdzz"},{n:"圣斗士星矢",v:"sdsxs"},{n:"魔力宝贝手游",v:"mlbbsy"},{n:"哈利波特:魔法觉醒",v:"HarryPotter"},{n:"手游推广",v:"rmsy"},{n:"魔灵召唤",v:"mlzh"},{n:"香肠派对",v:"xcpd"},{n:"迷你世界",v:"MNSJ"},{n:"荒野行动",v:"hyxd"},{n:"大话西游2口袋版",v:"dhxy2kdb"},{n:"FC足球世界",v:"FCZQSJ"},{n:"街篮",v:"jl"},{n:"一起来捉妖",v:"yiqilaizhuoyao"},{n:"明日方舟",v:"mrfz"},{n:"自由幻想手游",v:"zyhx"},{n:"一梦江湖",v:"ymjh"},{n:"王牌战争:文明重启",v:"wmcq"},{n:"完美世界手游",v:"wmsjsy"},{n:"拳皇98OL",v:"kof98"},{n:"赛尔号",v:"srh"},{n:"猎魂觉醒",v:"lhjx"},{n:"仙境传说",v:"xjcs"},{n:"逃跑吧少年",v:"tpbsn"},{n:"石器时代",v:"sqsd"},{n:"英魂之刃口袋版",v:"yh"},{n:"拉结尔",v:"lje"},{n:"倩女幽魂手游",v:"qnyhsy"},{n:"决斗之城2",v:"jdzc2"},{n:"传奇手游",v:"cqsy"},{n:"欢乐升级",v:"hlsj"},{n:"雀魂",v:"Majsoul"},{n:"二次元手游",v:"ecysy"},{n:"天龙八部online",v:"tianlongbabuonline"},{n:"征途2手游",v:"zt2sy"},{n:"万王之王3D",v:"wwzw3D"},{n:"武林外传",v:"wlwz"},{n:"我叫MT4",v:"MT4"},{n:"元气骑士",v:"yuanqiqishi"},{n:"红警OL手游",v:"hjolsy"},{n:"植物大战僵尸手游",v:"ZWDZJS"},{n:"龙之谷手游",v:"lzgsy"},{n:"创造与魔法",v:"ccymf"},{n:"境界-死神激斗",v:"jjssjd"},{n:"奇迹觉醒",v:"qjjx"},{n:"光遇",v:"skygy"},{n:"游戏王:决斗链接",v:"yxwjdlj"},{n:"巅峰战舰",v:"dfzj"},{n:"绝世战魂",v:"jszh"},{n:"寻仙",v:"xunxian"},{n:"天天象棋",v:"ttxq"},{n:"王国纪元",v:"wgjy"},{n:"龙族幻想",v:"lzhx"},{n:"剑网3指尖对弈",v:"jwszjdy"},{n:"剑侠情缘2:剑歌行",v:"jianxiaqingyuan"},{n:"三国杀移动版",v:"SGSSY"},{n:"罗布乐思",v:"Roblox"},{n:"足球手游",v:"zqsy"},{n:"月圆之夜",v:"yyzy"},{n:"王牌战争",v:"wpzz"},{n:"秦时明月世界",v:"qsmysj"},{n:"独立手游",v:"dlsy"},{n:"神都夜行录",v:"sdyxl"},{n:"风之大陆",v:"fzdl"},{n:"金属对决",v:"jsdj"},{n:"轩辕剑龙舞云山",v:"xyjlwys"},{n:"微乐棋牌",v:"WLQP"},{n:"辐射:避难所Online",v:"fsbnsonline"},{n:"街篮2",v:"jl2"},{n:"极光计划",v:"jgjh"},{n:"不良人3",v:"blr3"},{n:"镇魔曲手游",v:"zmq"},{n:"传奇世界手游",v:"cqsjsy"},{n:"永恒纪元",v:"yhjy"},{n:"乱世王者",v:"lswz"},{n:"数码宝贝:相遇",v:"smbbxy"},{n:"仙剑4",v:"xjqxz4"},{n:"长安幻世绘",v:"cahsh"},{n:"篮球手游",v:"lqsy"},{n:"鬼泣-巅峰之战",v:"gqdfzz"},{n:"射击类手游",v:"qtsy"},{n:"命运歌姬",v:"mygj"},{n:"光明大陆",v:"gmdl"},{n:"暗黑不朽",v:"diabloimmortal"},{n:"新神魔大陆",v:"xsmdl"},{n:"公主连结Re:Dive",v:"gzlj"},{n:"三国志战略版",v:"sgzzlb"},{n:"天地劫:幽城再临",v:"tdj"},{n:"Disorder",v:"Disorder"},{n:"凹凸世界",v:"atsj"},{n:"云上城之歌",v:"ysczg"},{n:"五子棋",v:"wzq"},{n:"围棋",v:"wq"},{n:"梦想新大陆",v:"mxxdl"},{n:"三国志幻想大陆:国创加强版",v:"sgzhxdl"},{n:"全球行动",v:"qqxd"},{n:"诛仙手游",v:"zxsy"},{n:"妄想山海",v:"wxsh"},{n:"黎明觉醒:生机",v:"lmjx"},{n:"龙之谷2手游",v:"lzg2sy"},{n:"庆余年",v:"QYN"},{n:"我的侠客",v:"wdxk"},{n:"曙光英雄",v:"sgyx"},{n:"真三国无双霸",v:"zsgwsb"},{n:"大话西游手游",v:"dhxysy"},{n:"口袋进化",v:"kdjh"},{n:"开心消消乐",v:"kxxxl"},{n:"战争怒吼",v:"zznh"},{n:"忘川风华录",v:"wcfhl"},{n:"新剑侠情缘手游",v:"xjxqysy"},{n:"重生细胞",v:"csxb"},{n:"汉家江湖",v:"HJJH"},{n:"海岛奇兵",v:"hdqb"},{n:"钢铁力量2",v:"gtll2"},{n:"仙剑奇侠传九野",v:"xjqxzjy"},{n:"魔域手游",v:"mysy"},{n:"大唐无双手游",v:"dtwssy"},{n:"地铁跑酷",v:"dtpk"},{n:"战舰世界闪击战",v:"zjsjsjz"},{n:"狂暴之翼",v:"kbzy"},{n:"西游女儿国",v:"xyneg"},{n:"少年三国志",v:"snsgz"},{n:"钢琴师",v:"gqs"},{n:"横扫千军",v:"hsqj"},{n:"节奏大爆炸",v:"jzdbz"},{n:"喵斯快跑",v:"mskp"},{n:"双子",v:"sz"},{n:"梦想世界3手游",v:"mxsj3"},{n:"精灵之境",v:"jlzj"},{n:"镇魂街:武神躯",v:"zhjwsq"},{n:"斗罗大陆:斗神再临",v:"dldldszl"},{n:"斗罗大陆:武魂觉醒",v:"dldlwhjx"},{n:"斗罗大陆2绝世唐门",v:"dldl2jstm"},{n:"战神觉醒",v:"zsjx"},{n:"九州仙剑传H5",v:"jzxjzh5"},{n:"荣耀大天使",v:"rydts"},{n:"蓝月传奇",v:"lycq"},{n:"凡人修仙传挂机版H5",v:"frxxzgjbh5"},{n:"我的帝国H5",v:"wddgh5"},{n:"盗墓笔记",v:"dmbj"},{n:"剑与轮回",v:"jylh"},{n:"混沌起源",v:"hdqy"},{n:"大天使之剑",v:"dtszj"},{n:"战斗少女跑酷",v:"zdsnpk"},{n:"绝世仙王",v:"jsxw"},{n:"一刀传世",v:"ydcs"},{n:"斗罗大陆",v:"dldl"},{n:"破雪刃",v:"pxr"},{n:"JJ象棋",v:"jjxq"},{n:"天姬变",v:"tjb"},{n:"剑玲珑",v:"jll"},{n:"火线精英",v:"hxjy"},{n:"造梦西游OL",v:"zmxyol"},{n:"奥奇传说手游",v:"aqcssy"},{n:"战斗吧龙魂",v:"zdblh"},{n:"剑开仙门",v:"jkxm"},{n:"机甲爱丽丝",v:"jjals"},{n:"狼人对决",v:"lrdj"},{n:"最终幻想:勇气启示录 幻影战争",v:"hyzz"},{n:"贝比岛",v:"bbd"},{n:"葫芦娃兄弟",v:"hlwxd"},{n:"造梦西游4",v:"zmxy4"},{n:"比特小队",v:"btxd"},{n:"流言侦探",v:"lyzt"},{n:"少女前线",v:"snqx"},{n:"遇见",v:"yj"},{n:"霓虹深渊:无限",v:"nhsywx"},{n:"胡莱三国3",v:"hlsg3"},{n:"奥拉星",v:"alx"},{n:"先游云游戏",v:"Gamer"},{n:"绿茵信仰",v:"lyxy"},{n:"蜀山掌门",v:"sszm"},{n:"球球联盟",v:"qqlm"},{n:"碧蓝航线手游",v:"blhxsy"},{n:"300大作战",v:"300dzz"},{n:"第七史诗",v:"dqss"},{n:"宝可梦大集结",v:"PokemonUNITE"},{n:"无极仙途",v:"wjxt"},{n:"汉末霸业",v:"hmby"},{n:"EVE星战前夜:无烬星河",v:"evexzqywjxh"},{n:"少女前线2:追放",v:"sq2zf"},{n:"火力苏打(T3)",v:"T3"},{n:"植物大战僵尸2",v:"zwdzjs2"},{n:"球球英雄",v:"qqyx"},{n:"悠长假期",v:"ycjq"},{n:"无悔华夏",v:"whrhx"},{n:"猫之城",v:"mzc"},{n:"墨斗",v:"modou"},{n:"圣斗士星矢:正义传说",v:"sdsxszyz"},{n:"未定事件簿",v:"wdsjp"},{n:"白夜极光",v:"byjg"},{n:"斗罗大陆:魂师对决",v:"dldlhsdj"},{n:"古墓丽影传说:迷踪",v:"gmlycsmz"},{n:"放置与召唤",v:"fzyzh"},{n:"闪烁之光",v:"syzg"},{n:"老农种树",v:"lnzs"},{n:"三国演义:吞噬无界",v:"sgyytswj"},{n:"偶像梦幻祭2",v:"oxmhj2"},{n:"卡卡保皇",v:"kkbh"},{n:"灵猫传",v:"lmz"},{n:"绝对演绎",v:"jdyy"},{n:"剑侠世界3",v:"jxsj3"},{n:"召唤与合成2",v:"zhyhc2"},{n:"仙侠第一放置",v:"xxdyfz"},{n:"弓箭手大作战",v:"gjsdzz"},{n:"挨饿荒野",v:"aehy"},{n:"诺亚之心",v:"nyzx"},{n:"闪耀暖暖",v:"synn"},{n:"模拟城市:我是市长",v:"mncswssc"},{n:"重返帝国",v:"cfdg"},{n:"长安幻想",v:"cahx"},{n:"火炬之光:无限",v:"hjzgwx"},{n:"富豪闯三国",v:"fhcsg"},{n:"拂晓",v:"fx"},{n:"火影忍者:忍者新世代",v:"hyrzrzxsd"},{n:"滚动的天空",v:"gddtk"},{n:"新斗罗大陆",v:"xdldl"},{n:"登山赛车",v:"dssc"},{n:"荒野乱斗(腾讯版)",v:"hyldtxb"},{n:"小小勇者",v:"xxyz"},{n:"小冰冰传奇",v:"xbbcq"},{n:"三国战纪2手游",v:"sgzj2"},{n:"我的战舰",v:"wdzj"},{n:"我是大东家",v:"wsddj"},{n:"幸存者危城",v:"xczwc"},{n:"暗魔领主",v:"amlz"},{n:"冒险公社手游",v:"mxgs"},{n:"欧陆战争5:帝国",v:"olzz5dg"},{n:"纪念碑谷2",v:"jnbg2"},{n:"大航海探险物语",v:"dhhtxwy"},{n:"我在7年后等着你",v:"wz7nhdzn"},{n:"航海日记",v:"hhrj"},{n:"一拳超人:最强之男",v:"yqcrzqzn"},{n:"王国保卫战4",v:"wgbwz4"},{n:"半世界之旅",v:"bsjzl"},{n:"奥特曼宇宙英雄",v:"atmyzyx"},{n:"新三国杀",v:"xsgs"},{n:"奶块",v:"nk"},{n:"策魂三国",v:"chsg"},{n:"奥特曼系列OL",v:"atmxlol"},{n:"洪荒文明",v:"hhwm"},{n:"街头足球",v:"jtzq"},{n:"同人圣三国蜀汉传",v:"trssgshc"},{n:"我做夫人那些年",v:"wzfrnxn"},{n:"小小五千年",v:"xxwqn"},{n:"实况球会经理",v:"skqhjl"},{n:"时空猎人",v:"sklr"},{n:"星际逆战",v:"xjnz"},{n:"LoveLive! 学园偶像祭",v:"lovelivexyoxj"},{n:"黑色沙漠手游",v:"hesmsy"},{n:"魔力宝贝:旅人",v:"mlbblr"},{n:"盾之勇者成名录:浪潮",v:"dzyzcmllc"},{n:"魔力宝贝归来",v:"mlbbgl"},{n:"荣耀新三国",v:"ryxsg"},{n:"巅峰极速",v:"dfjs"},{n:"新盗墓笔记",v:"xdmbj"},{n:"卧龙吟2",v:"wly2"},{n:"武林闲侠",v:"wlxx"},{n:"淘米游戏",v:"tmyx"},{n:"暖雪",v:"warmsnow"},{n:"无期迷途",v:"wqmt"},{n:"逆光潜入",v:"ngqr"},{n:"CF手游",v:"CFSY"},{n:"新天龙八部手游",v:"xtlbbsy"},{n:"无神之界",v:"wszj"},{n:"尘白禁区",v:"cbjq"},{n:"传奇天下",v:"CQTX"},{n:"全民大灌篮",v:"qmdgl"},{n:"枪火重生手游",v:"GunfireReborn"},{n:"火影三国志",v:"g_hysg"},{n:"网易其它组",v:"g_wyqt"},{n:"三国战纪手游",v:"sgzjsy"},{n:"染·钟楼谜团",v:"BOTC"},{n:"绝区零",v:"jql"},{n:"魔兽弧光大作战",v:"warcraftrumble"},{n:"重返CODM",v:"RECODM"},{n:"综合手游",v:"zhsy"},{n:"IP游戏",v:"ipyx"},{n:"鸣潮",v:"cm"},{n:"棋牌游戏",v:"QPYX"},{n:"奥比岛:梦想国度",v:"abdmxgd"},{n:"铃兰之剑",v:"llzjwzhpdsj"},{n:"晶核",v:"jhcoa"},{n:"星之破晓",v:"dhpx"},{n:"赛尔计划",v:"srjh"},{n:"SLG综合",v:"SLG"},{n:"代号:伙伴",v:"DHGB"},{n:"天使之战",v:"tszz"},{n:"全明星街球派对",v:"hoopheroes"},{n:"合金弹头:觉醒",v:"MetalSlug"},{n:"白荆回廊",v:"BJHL"},{n:"三国志战棋版",v:"g_sgzzqb"},{n:"鹅鸭杀手游",v:"GooseDuck"},{n:"太空杀",v:"SuperSus"},{n:"天龙八部2:飞龙战天",v:"tlbb2flzt"},{n:"西行纪 燃魂",v:"xxjrh"},{n:"决胜巅峰",v:"jueshengdianfeng"},{n:"冒险岛:枫之传说",v:"MapleStory"},{n:"石器时代:觉醒",v:"sqsdjx"},{n:"星球:重启",v:"xqcq"},{n:"决战玛法",v:"jzmf"},{n:"二次元游戏",v:"ECYYX"},{n:"圣境之塔",v:"sjzt"},{n:"传说法师手游",v:"CSFSSY"},{n:"钢岚",v:"Mecharashi"},{n:"勇闯三国",v:"ycsg"},{n:"绯色回响",v:"fshxgf"},{n:"三国:谋定天下",v:"sgmdtx"}]}],kjwh:[{key:"cateId",name:"分类",value:[{n:"数码科技",v:"smkj"},{n:"纪录片",v:"jlp"},{n:"成年教育",v:"jiaoyu"},{n:"人文社科",v:"Humanities"}]}],yp:[{key:"cateId",name:"分类",value:[{n:"派对",v:"paidui"},{n:"心动FM.",v:"DIANT"},{n:"一起玩",v:"yiqiwan"}]}],voice:[{key:"cateId",name:"分类",value:[{n:"语音交友",v:"yyjy"},{n:"音乐之声",v:"yyzs"},{n:"连麦互动",v:"lianmaihudong"},{n:"娱乐开黑",v:"ylkh"}]}]},filter_def:{yl:{cateId:"yqk"},PCgame:{cateId:"LOL"},djry:{cateId:"TVgame"},syxx:{cateId:"wzry"},yz:{cateId:"yz"},kjwh:{cateId:"smkj"},yp:{cateId:"yiqiwan"},voice:{cateId:"yyzs"},znl:{cateId:"znl"}},class_name:"娱乐天地&网游竞技&单机热游&手游休闲&颜值&科技文化&语音互动&语音直播&正能量",class_url:"yl&PCgame&djry&syxx&yz&kjwh&yp&voice&znl",detailUrl:"https://m.douyu.com/fyid?dyshid=0-1c6d52c74b1e6bec7aa63a8e000617p1&dyshci=181",searchUrl:"/api/search/liveRoom?#did=10000000000000000000000000001501&limit=20&offset=0&sk=**;post",searchable:2,quickSearch:0,headers:{"User-Agent":"MOBILE_UA"},timeout:5e3,limit:8,play_parse:!0,lazy:"","推荐":"js:\n let d = [];\n let jo = JSON.parse(request(input)).data;\n jo.forEach((it,idex) => {\n let slist = jo[idex].list ;\n slist.forEach(it => {\n d.push({\n url: it.rid,\n title: it.roomName,\n img: it.roomSrc,\n desc: '👁' + it.hn + ' 🆙' + it.nickname,\n })\n });\n });\n setResult(d);\n ","一级":"js:\n let d = [];\n let jo = JSON.parse(request(input)).data.list;\n jo.forEach(it => {\n d.push({\n url: it.rid,\n title: it.roomName,\n img: it.roomSrc,\n desc: '👁' + it.hn + ' 🆙' + it.nickname,\n })\n });\n setResult(d);\n ",
|
||||
|
||||
二级:'*',
|
||||
|
||||
"搜索":"js:\n var d = [];\n let rurls = input.split(';')[0].split('#');\n let rurl = rurls[0];\n let params = rurls.length > 1 ?rurls[1]:'';\n let _fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));\n let postData = {body:params};\n Object.assign(_fetch_params,postData);\n let jo = JSON.parse(post(rurl,_fetch_params)).data.list;\n jo.forEach(it => {\n d.push({\n url: it.roomId,\n title: it.roomName,\n img: it.roomSrc,\n desc: '👁' + it.hn + ' 🆙' + it.nickname,\n })\n });\n setResult(d);\n ",sniffer:1,isVideo:"js:\n log(input);\n if(/\\/huya/.test(input)) {\n input = true\n } else if(/\\.flv?|\\.m3u8?|\\.mp4?/.test(input)){\n input = true\n }else{\n input = false\n }\n "};
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
var rule = {
|
||||
类型: '影视',
|
||||
title: '星芽短剧app',
|
||||
host: 'https://app.whjzjx.cn',
|
||||
url: '/cloud/v2/theaterfyfilter',
|
||||
filter_url: '/home_page?theater_class_id=fyclass&type=1&{{fl.type or "class2_ids=0"}}&page_num=fypage&page_size=24',
|
||||
searchUrl: '/v3/search',
|
||||
searchable: 2,
|
||||
quickSearch: 1,
|
||||
filterable: 1,
|
||||
filter: 'H4sIAAAAAAAAA6vmUgACJUMlK4VoMBMEquEssGR2aiVQWqmksiBVSQdVKi8xNxUk93zj7qfzutFlyxJzSlNRTMZuA8I4kFlPW1e8bF6BZhbCTJCS5JzE4mKj+MyUYlsDJQx1tZha8dn3snnv0x1NxNpnQrF9T/uXvFjcSqx9phTb97xvw5Pdi1+saHjWTLSthpRb+6xjxvOl84i10IjycH3Z0PZi0VpiLTSnPFxX7n+xrYvoEKXcwqd9bU/7NxGdUCnPGS+2zni6cj/RUWhGeZAunfe0ZzfRFlKeSF+29z6fMp9YC6ngwSlznq5bQKx9xsbUKGxIzvzGVMgbfS1PdxIdkcaUR+SLCT1P180l1kJLyu1rmfhsC9Glm7ERxRY+2bWJhCg0MaTchzMnPGtEr9JxWmiBxT4UkVguVPFYrloA8HqNcnwIAAA=',
|
||||
headers: {
|
||||
"X-App-Id": "7",
|
||||
"platform": "1",
|
||||
"manufacturer": "Xiaomi",
|
||||
"version_name": "3.2.0.1",
|
||||
"user_agent": "Mozilla/5.0 (Linux; Android 11; M2012K10C Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.141 Mobile Safari/537.36",
|
||||
"dev_token": "BY1wFZd4K0vDqzVMbtHXNmlQ29ovO5peS5MsZ7VX1rQUXDwAqskxkJtiPMZCEj6MaW-40xNnbvn12F68nLEAMkRoD7tpoieO4nkUE-GLOYxqCs0xmxWgXAh0-7NmmGCHi95SlyZlpHeit94JfJPkpo-hl4JFru2wUI-4P0AwDc5Y*",
|
||||
"app_version": "3.2.0.1",
|
||||
"device_platform": "android",
|
||||
"personalized_recommend_status": "1",
|
||||
"device_type": "M2012K10C",
|
||||
"device_brand": "Redmi",
|
||||
"os_version": "11",
|
||||
"channel": "default",
|
||||
"raw_channel": "default",
|
||||
"oaid": "9494817a02a93435",
|
||||
"msa_oaid": "9494817a02a93435",
|
||||
"uuid": "randomUUID_f87c01c7-3d61-4feb-ade0-3d6d45d24dfd",
|
||||
"device_id": "23b07cf840c8b3eeca8c01fc56f0f0a09",
|
||||
"support_h265": "1",
|
||||
"Host": "app.whjzjx.cn",
|
||||
"Connection": "Keep-Alive",
|
||||
"User-Agent": "okhttp/4.10.0"
|
||||
},
|
||||
timeout: 5000,
|
||||
class_name: '天微-剧场&天微-热播剧&天微-会员专享&天微-星选好剧&天微-新剧&天微-阳光剧场',
|
||||
class_url: '1&2&8&7&3&5',
|
||||
预处理:$js.toString(()=>{
|
||||
let html = post('https://u.shytkjgs.com/user/v1/account/login', {
|
||||
headers: {
|
||||
'User-Agent': 'okhttp/4.10.0',
|
||||
'Accept-Encoding': 'gzip',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'x-app-id': '7',
|
||||
'platform': '1',
|
||||
'manufacturer': 'realme',
|
||||
'version_name': '3.3.1',
|
||||
'user_agent': 'Mozilla/5.0 (Linux; Android 9; RMX1931 Build/PQ3A.190605.05081124; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36',
|
||||
'app_version': '3.3.1',
|
||||
'device_platform': 'android',
|
||||
'personalized_recommend_status': '1',
|
||||
'device_type': 'RMX1931',
|
||||
'device_brand': 'realme',
|
||||
'os_version': '9',
|
||||
'channel': 'default',
|
||||
'raw_channel': 'default',
|
||||
'oaid': '',
|
||||
'msa_oaid': '',
|
||||
'uuid': 'randomUUID_914e7a9b-deac-4f80-9247-db56669187df',
|
||||
'device_id': '24250683a3bdb3f118dff25ba4b1cba1a',
|
||||
'ab_id': '',
|
||||
'support_h265': '1'
|
||||
},
|
||||
body: "device=24250683a3bdb3f118dff25ba4b1cba1a&install_first_open=false&first_install_time=1723214205125&last_update_time=1723214205125&report_link_url="
|
||||
});
|
||||
rule.headers['authorization'] = JSON.parse(html).data.token
|
||||
}),
|
||||
play_parse: true,
|
||||
lazy: $js.toString(() => {
|
||||
input = {
|
||||
url: input,
|
||||
parse: 0
|
||||
}
|
||||
}),
|
||||
double: true,
|
||||
一级: $js.toString(()=>{
|
||||
let d = [];
|
||||
let html = request(input,{headers:rule.headers});
|
||||
let data = JSON.parse(html).data.list;
|
||||
data.forEach(it => {
|
||||
let id = 'https://app.whjzjx.cn/v2/theater_parent/detail?theater_parent_id='+it.theater.id;
|
||||
d.push({
|
||||
url:id,
|
||||
title:it.theater.title,
|
||||
img:it.theater.cover_url,
|
||||
desc:it.theater.theme,
|
||||
})
|
||||
})
|
||||
setResult(d);
|
||||
}),
|
||||
二级: $js.toString(()=>{
|
||||
let urls = [];
|
||||
let html = request(input,{headers:rule.headers});
|
||||
let data = JSON.parse(html).data;
|
||||
data.theaters.forEach(it => {
|
||||
urls.push(it.num+'$'+it.son_video_url);
|
||||
})
|
||||
VOD = {
|
||||
vod_name: data.title,
|
||||
vod_pic: data.cover_url,
|
||||
vod_play_from: '天微剧场',
|
||||
vod_play_url: urls.join('#')
|
||||
};
|
||||
}),
|
||||
搜索: $js.toString(()=>{
|
||||
let html = post(input,{headers:rule.headers,body:{"text":KEY}})
|
||||
let list = JSON.parse(html).data.theater.search_data;
|
||||
list.forEach(it =>{
|
||||
let id = 'https://app.whjzjx.cn/v2/theater_parent/detail?theater_parent_id='+it.id;
|
||||
d.push({
|
||||
url:id,
|
||||
title:it.title,
|
||||
img:it.cover_url,
|
||||
content:it.introduction,
|
||||
})
|
||||
})
|
||||
setResult(d);
|
||||
}),
|
||||
}
|
||||
+412
@@ -0,0 +1,412 @@
|
||||
if (typeof Object.assign !== 'function') {
|
||||
Object.assign = function () {
|
||||
let target = arguments[0];
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
let source = arguments[i];
|
||||
for (let key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
}
|
||||
|
||||
// 通用免嗅探播放
|
||||
let common_lazy = `js:
|
||||
let html = request(input);
|
||||
let hconf = html.match(/r player_.*?=(.*?)</)[1];
|
||||
let json = JSON5.parse(hconf);
|
||||
let url = json.url;
|
||||
if (json.encrypt == '1') {
|
||||
url = unescape(url);
|
||||
} else if (json.encrypt == '2') {
|
||||
url = unescape(base64Decode(url));
|
||||
}
|
||||
if (/\\.(m3u8|mp4|m4a|mp3)/.test(url)) {
|
||||
input = {
|
||||
parse: 0,
|
||||
jx: 0,
|
||||
url: url,
|
||||
};
|
||||
} else {
|
||||
input;
|
||||
}`;
|
||||
// 默认嗅探播放
|
||||
|
||||
let def_lazy = `js:
|
||||
input = { parse: 1, url: input, js: '' };`;
|
||||
// 采集站播放
|
||||
|
||||
let cj_lazy = `js:
|
||||
if (/\\.(m3u8|mp4)/.test(input)) {
|
||||
input = { parse: 0, url: input };
|
||||
} else {
|
||||
if (rule.parse_url.startsWith('json:')) {
|
||||
let purl = rule.parse_url.replace('json:', '') + input;
|
||||
let html = request(purl);
|
||||
let json = JSON.parse(html);
|
||||
if (json.url) {
|
||||
input = { parse: 0, url: json.url };
|
||||
}
|
||||
} else {
|
||||
input = rule.parse_url + input;
|
||||
}
|
||||
}`;
|
||||
|
||||
function getMubans() {
|
||||
const mubanDict = { // 模板字典
|
||||
mx: {
|
||||
title: '',
|
||||
host: '',
|
||||
url: '/vodshow/fyclass--------fypage---/',
|
||||
searchUrl: '/vodsearch/**----------fypage---/',
|
||||
class_parse: '.top_nav li;a&&Text;a&&href;.*/(.*?)/',
|
||||
searchable: 2,
|
||||
quickSearch: 0,
|
||||
filterable: 0,
|
||||
headers: {
|
||||
'User-Agent': 'MOBILE_UA',
|
||||
},
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true,
|
||||
推荐: '.cbox_list;*;*;*;*;*',
|
||||
一级: 'ul.vodlist li;a&&title;a&&data-original;.pic_text&&Text;a&&href',
|
||||
二级: {
|
||||
title: 'h2&&Text;.content_detail:eq(1)&&li&&a:eq(2)&&Text',
|
||||
img: '.vodlist_thumb&&data-original',
|
||||
desc: '.content_detail:eq(1)&&li:eq(1)&&Text;.content_detail:eq(1)&&li&&a&&Text;.content_detail:eq(1)&&li&&a:eq(1)&&Text;.content_detail:eq(1)&&li:eq(2)&&Text;.content_detail:eq(1)&&li:eq(3)&&Text',
|
||||
content: '.content_desc&&span&&Text',
|
||||
tabs: '.play_source_tab&&a',
|
||||
lists: '.content_playlist:eq(#id) li',
|
||||
},
|
||||
搜索: '*',
|
||||
},
|
||||
mxpro: {
|
||||
title: '',
|
||||
host: '', // homeUrl:'/',
|
||||
url: '/vodshow/fyclass--------fypage---.html',
|
||||
searchUrl: '/vodsearch/**----------fypage---.html',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
headers: {//网站的请求头,完整支持所有的,常带ua和cookies
|
||||
'User-Agent': 'MOBILE_UA', // "Cookie": "searchneed=ok"
|
||||
},
|
||||
class_parse: '.navbar-items li:gt(0):lt(10);a&&Text;a&&href;/(\\d+)',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true, // 推荐内容是否双层定位
|
||||
推荐: '.tab-list.active;a.module-poster-item.module-item;.module-poster-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href',
|
||||
一级: 'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href',
|
||||
二级: {
|
||||
title: 'h1&&Text;.module-info-tag-link:eq(-1)&&Text',
|
||||
img: '.lazyload&&data-original||data-src||src',
|
||||
desc: '.module-info-item:eq(-2)&&Text;.module-info-tag-link&&Text;.module-info-tag-link:eq(1)&&Text;.module-info-item:eq(2)&&Text;.module-info-item:eq(1)&&Text',
|
||||
content: '.module-info-introduction&&Text',
|
||||
tabs: '.module-tab-item',
|
||||
lists: '.module-play-list:eq(#id) a',
|
||||
tab_text: 'div--small&&Text',
|
||||
},
|
||||
搜索: 'body .module-item;.module-card-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href;.module-info-item-content&&Text',
|
||||
}, mxone5: {
|
||||
title: '',
|
||||
host: '',
|
||||
url: '/show/fyclass--------fypage---.html',
|
||||
searchUrl: '/search/**----------fypage---.html',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
class_parse: '.nav-menu-items&&li;a&&Text;a&&href;.*/(.*?)\.html',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true, // 推荐内容是否双层定位
|
||||
推荐: '.module-list;.module-items&&.module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
|
||||
一级: '.module-items .module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
|
||||
二级: {
|
||||
title: 'h1&&Text;.tag-link&&Text',
|
||||
img: '.module-item-pic&&img&&data-src',
|
||||
desc: '.video-info-items:eq(3)&&Text;.tag-link:eq(2)&&Text;.tag-link:eq(1)&&Text;.video-info-items:eq(1)&&Text;.video-info-items:eq(0)&&Text',
|
||||
content: '.vod_content&&Text',
|
||||
tabs: '.module-tab-item',
|
||||
lists: '.module-player-list:eq(#id)&&.scroll-content&&a',
|
||||
tab_text: 'div--small&&Text',
|
||||
},
|
||||
搜索: '.module-items .module-search-item;a&&title;img&&data-src;.video-serial&&Text;a&&href',
|
||||
}, 首图: {
|
||||
title: '',
|
||||
host: '',
|
||||
url: '/vodshow/fyclass--------fypage---/',
|
||||
searchUrl: '/vodsearch/**----------fypage---.html',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
headers: {//网站的请求头,完整支持所有的,常带ua和cookies
|
||||
'User-Agent': 'MOBILE_UA', // "Cookie": "searchneed=ok"
|
||||
},
|
||||
class_parse: '.myui-header__menu li.hidden-sm:gt(0):lt(7);a&&Text;a&&href;/(\\d+).html',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true, // 推荐内容是否双层定位
|
||||
推荐: 'ul.myui-vodlist.clearfix;li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
|
||||
一级: '.myui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
|
||||
二级: {
|
||||
title: '.myui-content__detail .title--span&&Text;.myui-content__detail p.data:eq(3)&&Text',
|
||||
img: '.myui-content__thumb .lazyload&&data-original',
|
||||
desc: '.myui-content__detail p.otherbox&&Text;.year&&Text;.myui-content__detail p.data:eq(4)&&Text;.myui-content__detail p.data:eq(2)&&Text;.myui-content__detail p.data:eq(0)&&Text',
|
||||
content: '.content&&Text',
|
||||
tabs: '.myui-panel__head&&li',
|
||||
// tabs: '.nav-tabs&&li',
|
||||
lists: '.myui-content__list:eq(#id) li',
|
||||
},
|
||||
搜索: '#searchList li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href;.detail&&Text',
|
||||
}, 首图2: {
|
||||
title: '',
|
||||
host: '',
|
||||
url: '/list/fyclass-fypage.html',
|
||||
searchUrl: '/vodsearch/**----------fypage---.html',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
headers: {
|
||||
'User-Agent': 'UC_UA', // "Cookie": ""
|
||||
},
|
||||
class_parse: '.stui-header__menu li:gt(0):lt(7);a&&Text;a&&href;.*/(.*?).html',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true, // 推荐内容是否双层定位
|
||||
推荐: 'ul.stui-vodlist.clearfix;li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href',
|
||||
一级: '.stui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
|
||||
二级: {
|
||||
title: '.stui-content__detail .title&&Text;.stui-content__detail&&p:eq(-2)&&a&&Text',
|
||||
title1: '.stui-content__detail .title&&Text;.stui-content__detail&&p&&Text',
|
||||
img: '.stui-content__thumb .lazyload&&data-original',
|
||||
desc: '.stui-content__detail p&&Text;.stui-content__detail&&p:eq(-2)&&a:eq(2)&&Text;.stui-content__detail&&p:eq(-2)&&a:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text;.stui-content__detail p:eq(1)&&Text',
|
||||
desc1: '.stui-content__detail p:eq(4)&&Text;;;.stui-content__detail p:eq(1)&&Text',
|
||||
content: '.detail&&Text',
|
||||
tabs: '.stui-pannel__head h3',
|
||||
tabs1: '.stui-vodlist__head h3',
|
||||
lists: '.stui-content__playlist:eq(#id) li',
|
||||
},
|
||||
搜索: 'ul.stui-vodlist__media,ul.stui-vodlist,#searchList li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href;.detail&&Text',
|
||||
}, 默认: {
|
||||
title: '',
|
||||
host: '',
|
||||
url: '',
|
||||
searchUrl: '',
|
||||
searchable: 2,
|
||||
quickSearch: 0,
|
||||
filterable: 0,
|
||||
filter: '',
|
||||
filter_url: '',
|
||||
filter_def: {},
|
||||
headers: {
|
||||
'User-Agent': 'MOBILE_UA',
|
||||
},
|
||||
timeout: 5000,
|
||||
class_parse: '#side-menu li;a&&Text;a&&href;/(.*?)\.html',
|
||||
cate_exclude: '',
|
||||
play_parse: true,
|
||||
lazy: def_lazy,
|
||||
double: true,
|
||||
推荐: '列表1;列表2;标题;图片;描述;链接;详情',
|
||||
一级: '列表;标题;图片;描述;链接;详情',
|
||||
二级: {
|
||||
title: 'vod_name;vod_type',
|
||||
img: '图片链接',
|
||||
desc: '主要信息;年代;地区;演员;导演',
|
||||
content: '简介',
|
||||
tabs: '',
|
||||
lists: 'xx:eq(#id)&&a',
|
||||
tab_text: 'body&&Text',
|
||||
list_text: 'body&&Text',
|
||||
list_url: 'a&&href',
|
||||
},
|
||||
搜索: '列表;标题;图片;描述;链接;详情',
|
||||
}, vfed: {
|
||||
title: '',
|
||||
host: '',
|
||||
url: '/index.php/vod/show/id/fyclass/page/fypage.html',
|
||||
searchUrl: '/index.php/vod/search/page/fypage/wd/**.html',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
headers: {
|
||||
'User-Agent': 'UC_UA',
|
||||
},
|
||||
class_parse: '.fed-pops-navbar&&ul.fed-part-rows&&a;a&&Text;a&&href;.*/(.*?).html',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true, // 推荐内容是否双层定位
|
||||
推荐: 'ul.fed-list-info.fed-part-rows;li;a.fed-list-title&&Text;a&&data-original;.fed-list-remarks&&Text;a&&href',
|
||||
一级: '.fed-list-info&&li;a.fed-list-title&&Text;a&&data-original;.fed-list-remarks&&Text;a&&href',
|
||||
二级: {
|
||||
title: 'h1.fed-part-eone&&Text;.fed-deta-content&&.fed-part-rows&&li&&Text',
|
||||
img: '.fed-list-info&&a&&data-original',
|
||||
desc: '.fed-deta-content&&.fed-part-rows&&li:eq(1)&&Text;.fed-deta-content&&.fed-part-rows&&li:eq(2)&&Text;.fed-deta-content&&.fed-part-rows&&li:eq(3)&&Text',
|
||||
content: '.fed-part-esan&&Text',
|
||||
tabs: '.fed-drop-boxs&&.fed-part-rows&&li',
|
||||
lists: '.fed-play-item:eq(#id)&&ul:eq(1)&&li',
|
||||
},
|
||||
搜索: '.fed-deta-info;h1&&Text;.lazyload&&data-original;.fed-list-remarks&&Text;a&&href;.fed-deta-content&&Text',
|
||||
}, 海螺3: {
|
||||
title: '',
|
||||
host: '',
|
||||
searchUrl: '/v_search/**----------fypage---.html',
|
||||
url: '/vod_____show/fyclass--------fypage---.html',
|
||||
headers: {
|
||||
'User-Agent': 'MOBILE_UA',
|
||||
},
|
||||
timeout: 5000,
|
||||
class_parse: 'body&&.hl-nav li:gt(0);a&&Text;a&&href;.*/(.*?).html',
|
||||
cate_exclude: '明星|专题|最新|排行',
|
||||
limit: 40,
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
double: true,
|
||||
推荐: '.hl-vod-list;li;a&&title;a&&data-original;.remarks&&Text;a&&href',
|
||||
一级: '.hl-vod-list&&.hl-list-item;a&&title;a&&data-original;.remarks&&Text;a&&href',
|
||||
二级: {
|
||||
title: '.hl-dc-title&&Text;.hl-dc-content&&li:eq(6)&&Text',
|
||||
img: '.hl-lazy&&data-original',
|
||||
desc: '.hl-dc-content&&li:eq(10)&&Text;.hl-dc-content&&li:eq(4)&&Text;.hl-dc-content&&li:eq(5)&&Text;.hl-dc-content&&li:eq(2)&&Text;.hl-dc-content&&li:eq(3)&&Text',
|
||||
content: '.hl-content-text&&Text',
|
||||
tabs: '.hl-tabs&&a',
|
||||
tab_text: 'a--span&&Text',
|
||||
lists: '.hl-plays-list:eq(#id)&&li',
|
||||
},
|
||||
搜索: '.hl-list-item;a&&title;a&&data-original;.remarks&&Text;a&&href',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
}, 海螺2: {
|
||||
title: '',
|
||||
host: '',
|
||||
searchUrl: '/index.php/vod/search/page/fypage/wd/**/',
|
||||
url: '/index.php/vod/show/id/fyclass/page/fypage/',
|
||||
headers: {
|
||||
'User-Agent': 'MOBILE_UA',
|
||||
},
|
||||
timeout: 5000,
|
||||
class_parse: '#nav-bar li;a&&Text;a&&href;id/(.*?)/',
|
||||
limit: 40,
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
double: true,
|
||||
推荐: '.list-a.size;li;a&&title;.lazy&&data-original;.bt&&Text;a&&href',
|
||||
一级: '.list-a&&li;a&&title;.lazy&&data-original;.list-remarks&&Text;a&&href',
|
||||
二级: {
|
||||
title: 'h2&&Text;.deployment&&Text',
|
||||
img: '.lazy&&data-original',
|
||||
desc: '.deployment&&Text',
|
||||
content: '.ec-show&&Text',
|
||||
tabs: '#tag&&a',
|
||||
lists: '.play_list_box:eq(#id)&&li',
|
||||
},
|
||||
搜索: '.search-list;a&&title;.lazy&&data-original;.deployment&&Text;a&&href',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
}, 短视: {
|
||||
title: '',
|
||||
host: '', // homeUrl:'/',
|
||||
url: '/channel/fyclass-fypage.html',
|
||||
searchUrl: '/search.html?wd=**',
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 0,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
headers: {//网站的请求头,完整支持所有的,常带ua和cookies
|
||||
'User-Agent': 'MOBILE_UA', // "Cookie": "searchneed=ok"
|
||||
},
|
||||
class_parse: '.menu_bottom ul li;a&&Text;a&&href;.*/(.*?).html',
|
||||
cate_exclude: '解析|动态',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
double: true, // 推荐内容是否双层定位
|
||||
推荐: '.indexShowBox;ul&&li;a&&title;img&&data-src;.s1&&Text;a&&href',
|
||||
一级: '.pic-list&&li;a&&title;img&&data-src;.s1&&Text;a&&href',
|
||||
二级: {
|
||||
title: 'h1&&Text;.content-rt&&p:eq(0)&&Text',
|
||||
img: '.img&&img&&data-src',
|
||||
desc: '.content-rt&&p:eq(1)&&Text;.content-rt&&p:eq(2)&&Text;.content-rt&&p:eq(3)&&Text;.content-rt&&p:eq(4)&&Text;.content-rt&&p:eq(5)&&Text',
|
||||
content: '.zkjj_a&&Text',
|
||||
tabs: '.py-tabs&&option',
|
||||
lists: '.player:eq(#id) li',
|
||||
},
|
||||
搜索: '.sr_lists&&ul&&li;h3&&Text;img&&data-src;.int&&p:eq(0)&&Text;a&&href',
|
||||
}, 短视2: {
|
||||
title: '',
|
||||
host: '',
|
||||
class_name: '电影&电视剧&综艺&动漫',
|
||||
class_url: '1&2&3&4',
|
||||
searchUrl: '/index.php/ajax/suggest?mid=1&wd=**&limit=50',
|
||||
searchable: 2,
|
||||
quickSearch: 0,
|
||||
headers: {'User-Agent': 'MOBILE_UA'},
|
||||
url: '/index.php/api/vod#type=fyclass&page=fypage',
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
filter_url: '',
|
||||
filter: {},
|
||||
filter_def: {},
|
||||
detailUrl: '/index.php/vod/detail/id/fyid.html',
|
||||
play_parse: true,
|
||||
lazy: common_lazy,
|
||||
limit: 6,
|
||||
推荐: '.list-vod.flex .public-list-box;a&&title;.lazy&&data-original;.public-list-prb&&Text;a&&href',
|
||||
一级: 'js:let body=input.split("#")[1];let t=Math.round(new Date/1e3).toString();let key=md5("DS"+t+"DCC147D11943AF75");let url=input.split("#")[0];body=body+"&time="+t+"&key="+key;print(body);fetch_params.body=body;let html=post(url,fetch_params);let data=JSON.parse(html);VODS=data.list.map(function(it){it.vod_pic=urljoin2(input.split("/i")[0],it.vod_pic);return it});',
|
||||
二级: {
|
||||
title: '.slide-info-title&&Text;.slide-info:eq(2)--strong&&Text',
|
||||
img: '.detail-pic&&data-original',
|
||||
desc: '.slide-info-remarks&&Text;.slide-info-remarks:eq(1)&&Text;.slide-info-remarks:eq(2)&&Text;.slide-info:eq(1)--strong&&Text;.info-parameter&&ul&&li:eq(3)&&Text',
|
||||
content: '#height_limit&&Text',
|
||||
tabs: '.anthology.wow.fadeInUp.animated&&.swiper-wrapper&&a',
|
||||
tab_text: 'a--span&&Text',
|
||||
lists: '.anthology-list-box:eq(#id) li',
|
||||
},
|
||||
搜索: 'json:list;name;pic;;id',
|
||||
}, 采集1: {
|
||||
title: '',
|
||||
host: '',
|
||||
homeTid: '13',
|
||||
homeUrl: '/api.php/provide/vod/?ac=detail&t={{rule.homeTid}}',
|
||||
detailUrl: '/api.php/provide/vod/?ac=detail&ids=fyid',
|
||||
searchUrl: '/api.php/provide/vod/?wd=**&pg=fypage',
|
||||
url: '/api.php/provide/vod/?ac=detail&pg=fypage&t=fyclass',
|
||||
headers: {'User-Agent': 'MOBILE_UA'},
|
||||
timeout: 5000, // class_name: '电影&电视剧&综艺&动漫',
|
||||
// class_url: '1&2&3&4',
|
||||
// class_parse:'js:let html=request(input);input=JSON.parse(html).class;',
|
||||
class_parse: 'json:class;',
|
||||
limit: 20,
|
||||
multi: 1,
|
||||
searchable: 2,//是否启用全局搜索,
|
||||
quickSearch: 1,//是否启用快速搜索,
|
||||
filterable: 0,//是否启用分类筛选,
|
||||
play_parse: true,
|
||||
parse_url: '',
|
||||
lazy: cj_lazy,
|
||||
推荐: '*',
|
||||
一级: 'json:list;vod_name;vod_pic;vod_remarks;vod_id;vod_play_from',
|
||||
二级: `js:
|
||||
let html=request(input);
|
||||
html=JSON.parse(html);
|
||||
let data=html.list;
|
||||
VOD=data[0];`,
|
||||
搜索: '*',
|
||||
},
|
||||
};
|
||||
return JSON.parse(JSON.stringify(mubanDict));
|
||||
}
|
||||
|
||||
var mubanDict = getMubans();
|
||||
var muban = getMubans();
|
||||
export default {muban, getMubans};
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"规则名": "河马短剧",
|
||||
"规则作者": "香雅情",
|
||||
"请求头参数": "MOBILE_UA",
|
||||
"网页编码格式": "UTF-8",
|
||||
"图片是否需要代理": "否",
|
||||
"是否开启获取首页数据": "否",
|
||||
"首页推荐链接": "https://www.kuaikaw.cn",
|
||||
"首页列表数组规则": "body&&.module-items",
|
||||
"首页片单列表数组规则": ".module-item:lt(12)",
|
||||
"首页片单是否Jsoup写法": "1",
|
||||
"分类起始页码": "1",
|
||||
"分类链接": "https://www.kuaikaw.cn/browse/{cateId}/{catePg}[firstPage=https://www.kuaikaw.cn/browse/{cateId}]",
|
||||
"分类名称": "全部",
|
||||
"分类名称替换词": "0",
|
||||
//"筛选数据": {},
|
||||
"筛选数据": "ext",
|
||||
//{cateId}
|
||||
"筛选子分类名称": "全部&民国&萌宝&动漫&超能&甜宠&豪门恩怨&长生&神医&寻亲&抗战谍战&电视剧&奇幻&闪婚&职场商战&权谋&高手下山&神话&时空之旅&欢喜冤家&都市&体育&家庭&喜剧&都市修仙&神豪&科幻&致富&奇幻脑洞&强者回归&励志&复仇&电影&马甲&亲情&小人物&无敌&现实&重生&穿越&年代&悬疑&婚姻&家国情仇&虐恋&古装&仙侠&玄幻仙侠&传承觉醒&功夫武打&戏曲歌舞&情感&逆袭&战争",
|
||||
"筛选子分类替换词": "0&590-839&589&1115&442&462&585&1073&438&1125&1093&1092-1097&715&713&943&840-1101&474&1094&718&717&1129&1128&714-1126&917&1124&475&1130&918&721&476&1076-1100&416-463&1091-1096&719&835-837&472&1074&441-469&439-465&916&716-722&445-470&1127&915&466&444-468&1102&720&473&1095&1098&838&417-464&1099",
|
||||
//{class}
|
||||
"筛选类型名称": "",
|
||||
"筛选类型替换词": "*",
|
||||
//{area}
|
||||
"筛选地区名称": "",
|
||||
"筛选地区替换词": "*",
|
||||
//{year}
|
||||
"筛选年份名称": "",
|
||||
"筛选年份替换词": "*",
|
||||
//{lang}
|
||||
"筛选语言名称": "",
|
||||
"筛选语言替换词": "*",
|
||||
//{by}
|
||||
"筛选排序名称": "时间&人气&评分",
|
||||
"筛选排序替换词": "time&hits&score",
|
||||
"分类截取模式": "1",
|
||||
"分类列表数组规则": ".BrowseList_listBox__MyeBa&&.BrowseList_listItem__h7lD4",
|
||||
"分类片单是否Jsoup写法": "是",
|
||||
"分类片单标题": "img&&alt",
|
||||
"分类片单链接": "a&&href",
|
||||
"分类片单图片": "img&&src",
|
||||
"分类片单副标题": ".BrowseList_lastChapter__dkL54&&Text",
|
||||
"分类片单链接加前缀": "https://www.kuaikaw.cn",
|
||||
"分类片单链接加后缀": "",
|
||||
"搜索请求头参数": "User-Agent$MOBILE_UA",
|
||||
"搜索链接": "https://www.kuaikaw.cn/search/{SearchPg}?searchValue={wd}",
|
||||
"POST请求数据": "",
|
||||
"搜索截取模式": "1",
|
||||
"搜索列表数组规则": ".search_searchList__AvbeR&&.MTagBookList_tagBookItem__C_038",
|
||||
"搜索片单是否Jsoup写法": "是",
|
||||
"搜索片单图片": "img&&src",
|
||||
"搜索片单标题": "img&&alt",
|
||||
"搜索片单链接": "a&&href",
|
||||
"搜索片单副标题": "",
|
||||
"搜索片单链接加前缀": "https://www.kuaikaw.cn",
|
||||
"搜索片单链接加后缀": "",
|
||||
"链接是否直接播放": "否",
|
||||
"直接播放链接加前缀": "",
|
||||
"直接播放链接加后缀": "",
|
||||
"直接播放直链视频请求头": "",
|
||||
"详情是否Jsoup写法": "是",
|
||||
"类型详情": "",
|
||||
"年代详情": "",
|
||||
"地区详情": "",
|
||||
"演员详情": "",
|
||||
"简介详情": ".introduction_introBox__t4Bbz&&Text",
|
||||
"线路列表数组规则": "",
|
||||
"线路标题": "Text",
|
||||
"播放列表数组规则": "body&&.CatalogList_swiperBox__5kdPs",
|
||||
"选集列表数组规则": "a:not(:has(img))",
|
||||
"选集标题链接是否Jsoup写法": "是",
|
||||
"选集标题": "a&&Text",
|
||||
"选集链接": "a&&href",
|
||||
"是否反转选集序列": "否",
|
||||
"选集链接加前缀": "https://www.kuaikaw.cn",
|
||||
"选集链接加后缀": "",
|
||||
"分析MacPlayer": "否",
|
||||
"是否开启手动嗅探": "否",
|
||||
"手动嗅探视频链接关键词": ".mp4#.m3u8#.flv#video/tos",
|
||||
"手动嗅探视频链接过滤词": ".html#=http"
|
||||
}
|
||||
+705
@@ -0,0 +1,705 @@
|
||||
{
|
||||
|
||||
"class": [{
|
||||
"type_name": "演唱会筛选",
|
||||
"type_id": "演唱会超清"
|
||||
},
|
||||
{
|
||||
"type_name": "粤语",
|
||||
"type_id": "粤语歌曲超清"
|
||||
},
|
||||
{
|
||||
"type_name": "2024年热榜",
|
||||
"type_id": "2024年热门歌曲超清"
|
||||
},
|
||||
{
|
||||
"type_name": "2023年热榜",
|
||||
"type_id": "2023年热门歌曲超清"
|
||||
},
|
||||
{
|
||||
"type_name": "抖音神曲",
|
||||
"type_id": "抖音神曲超清"
|
||||
},
|
||||
{
|
||||
"type_name": "经典老歌",
|
||||
"type_id": "经典老歌超清"
|
||||
},
|
||||
{
|
||||
"type_name": "DJ",
|
||||
"type_id": "DJ歌曲超清"
|
||||
},
|
||||
{
|
||||
"type_name": "网红翻唱",
|
||||
"type_id": "网红翻唱歌曲超清"
|
||||
},
|
||||
{
|
||||
"type_name": "韩国女团",
|
||||
"type_id": "韩国女团演唱会超清"
|
||||
}
|
||||
|
||||
|
||||
],
|
||||
|
||||
"filters": {
|
||||
"演唱会超清": [{
|
||||
"key": "order",
|
||||
"name": "排序",
|
||||
"value": [{
|
||||
"n": "综合排序",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "最多点击",
|
||||
"v": "click"
|
||||
},
|
||||
{
|
||||
"n": "最新发布",
|
||||
"v": "pubdate"
|
||||
},
|
||||
{
|
||||
"n": "最多弹幕",
|
||||
"v": "dm"
|
||||
},
|
||||
{
|
||||
"n": "最多收藏",
|
||||
"v": "stow"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "tid",
|
||||
"name": "分类",
|
||||
"value": [{
|
||||
"n": "全部",
|
||||
"v": "演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "A阿杜",
|
||||
"v": "阿杜演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "A阿黛尔",
|
||||
"v": "阿黛尔演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "BBeyond",
|
||||
"v": "Beyond演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "BBy2",
|
||||
"v": "By2演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "BBIGBANG",
|
||||
"v": "BIGBANG演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "B布兰妮",
|
||||
"v": "布兰妮演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "B坂井泉水",
|
||||
"v": "坂井泉水演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C陈奕迅",
|
||||
"v": "陈奕迅演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C蔡依林",
|
||||
"v": "蔡依林演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C初音未来",
|
||||
"v": "初音未来演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C蔡健雅",
|
||||
"v": "蔡健雅演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C陈小春",
|
||||
"v": "陈小春演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C草蜢",
|
||||
"v": "草蜢演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C陈慧娴",
|
||||
"v": "陈慧娴演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C崔健",
|
||||
"v": "崔健演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "C仓木麻衣",
|
||||
"v": "仓木麻衣演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D戴荃",
|
||||
"v": "戴荃演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D动力火车",
|
||||
"v": "动力火车演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D邓丽君",
|
||||
"v": "邓丽君演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D丁当",
|
||||
"v": "丁当演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D刀郎",
|
||||
"v": "刀郎演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D邓紫棋",
|
||||
"v": "邓紫棋演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D戴佩妮",
|
||||
"v": "戴佩妮演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "D邓丽君",
|
||||
"v": "邓丽君演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F飞儿乐队",
|
||||
"v": "飞儿乐队演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F费玉清",
|
||||
"v": "费玉清演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F费翔",
|
||||
"v": "费翔演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F方大同",
|
||||
"v": "方大同演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F房东的猫",
|
||||
"v": "房东的猫演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F凤飞飞",
|
||||
"v": "凤飞飞演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "F凤凰传奇",
|
||||
"v": "凤凰传奇演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "G郭采洁",
|
||||
"v": "郭采洁演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "G光良",
|
||||
"v": "光良演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "G郭静",
|
||||
"v": "郭静演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "G郭富城",
|
||||
"v": "郭富城演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H胡彦斌",
|
||||
"v": "胡彦斌演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H胡夏",
|
||||
"v": "胡夏演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H韩红",
|
||||
"v": "韩红演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H黄品源",
|
||||
"v": "黄品源演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H黄小琥",
|
||||
"v": "黄小琥演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H花儿乐队",
|
||||
"v": "花儿乐队演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H黄家强",
|
||||
"v": "黄家强演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "H后街男孩",
|
||||
"v": "后街男孩演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "J经典老歌",
|
||||
"v": "经典老歌演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "J贾斯丁比伯",
|
||||
"v": "贾斯丁比伯演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "J金池",
|
||||
"v": "金池演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "J金志文",
|
||||
"v": "金志文演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "J焦迈奇",
|
||||
"v": "焦迈奇演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "K筷子兄弟",
|
||||
"v": "筷子兄弟演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李玟",
|
||||
"v": "李玟演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L林忆莲",
|
||||
"v": "林忆莲演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李克勤",
|
||||
"v": "李克勤演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L刘宪华",
|
||||
"v": "刘宪华演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李圣杰",
|
||||
"v": "李圣杰演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L林宥嘉",
|
||||
"v": "林宥嘉演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L梁静茹",
|
||||
"v": "梁静茹演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李健",
|
||||
"v": "李健演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L林俊杰",
|
||||
"v": "林俊杰演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李玉刚",
|
||||
"v": "李玉刚演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L林志炫",
|
||||
"v": "林志炫演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李荣浩",
|
||||
"v": "李荣浩演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李宇春",
|
||||
"v": "李宇春演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L洛天依",
|
||||
"v": "洛天依演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L林子祥",
|
||||
"v": "林子祥演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L李宗盛",
|
||||
"v": "李宗盛演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L黎明",
|
||||
"v": "黎明演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L刘德华",
|
||||
"v": "刘德华演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L罗大佑",
|
||||
"v": "罗大佑演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L林肯公园",
|
||||
"v": "林肯公园演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "LLadyGaga",
|
||||
"v": "LadyGaga演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "L旅行团乐队",
|
||||
"v": "旅行团乐队演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "M莫文蔚",
|
||||
"v": "莫文蔚演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "M毛不易",
|
||||
"v": "毛不易演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "M梅艳芳",
|
||||
"v": "梅艳芳演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "M迈克尔杰克逊",
|
||||
"v": "迈克尔杰克逊演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "N南拳妈妈",
|
||||
"v": "南拳妈妈演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "P朴树",
|
||||
"v": "朴树演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Q齐秦",
|
||||
"v": "齐秦演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Q青鸟飞鱼",
|
||||
"v": "青鸟飞鱼演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "R容祖儿",
|
||||
"v": "容祖儿演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "R任贤齐",
|
||||
"v": "任贤齐演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "S水木年华",
|
||||
"v": "水木年华演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "S孙燕姿",
|
||||
"v": "孙燕姿演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "S苏打绿",
|
||||
"v": "苏打绿演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "SSHE",
|
||||
"v": "SHE演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "S孙楠",
|
||||
"v": "孙楠演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T陶喆",
|
||||
"v": "陶喆演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T谭咏麟",
|
||||
"v": "谭咏麟演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T田馥甄",
|
||||
"v": "田馥甄演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T谭维维",
|
||||
"v": "谭维维演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T逃跑计划",
|
||||
"v": "逃跑计划演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T田震",
|
||||
"v": "田震演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T谭晶",
|
||||
"v": "谭晶演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T屠洪刚",
|
||||
"v": "屠洪刚演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "T泰勒·斯威夫特",
|
||||
"v": "泰勒·斯威夫特演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W王力宏",
|
||||
"v": "王力宏演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W王杰",
|
||||
"v": "王杰演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W吴克群",
|
||||
"v": "吴克群演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W王心凌",
|
||||
"v": "王心凌演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W王靖雯",
|
||||
"v": "好声音王靖雯演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W汪峰",
|
||||
"v": "汪峰演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W伍佰",
|
||||
"v": "伍佰演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W王菲",
|
||||
"v": "王菲演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W五月天",
|
||||
"v": "五月天演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "W汪苏泷",
|
||||
"v": "汪苏泷演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X徐佳莹",
|
||||
"v": "徐佳莹演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X弦子",
|
||||
"v": "弦子演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X萧亚轩",
|
||||
"v": "萧亚轩演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X许巍",
|
||||
"v": "许巍演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X薛之谦",
|
||||
"v": "薛之谦演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X许嵩",
|
||||
"v": "许嵩演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X小虎队",
|
||||
"v": "小虎队演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X萧敬腾",
|
||||
"v": "萧敬腾演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X谢霆锋",
|
||||
"v": "谢霆锋演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X徐小凤",
|
||||
"v": "徐小凤演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "X信乐队",
|
||||
"v": "信乐队演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y夜愿乐队",
|
||||
"v": "夜愿乐队演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y羽泉",
|
||||
"v": "羽泉演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y郁可唯",
|
||||
"v": "郁可唯演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y叶倩文",
|
||||
"v": "叶倩文演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y杨坤",
|
||||
"v": "杨坤演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y庾澄庆",
|
||||
"v": "庾澄庆演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y尤长靖",
|
||||
"v": "尤长靖演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y易烊千玺",
|
||||
"v": "易烊千玺演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y袁娅维",
|
||||
"v": "袁娅维演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y杨丞琳",
|
||||
"v": "杨丞琳演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y杨千嬅",
|
||||
"v": "杨千嬅演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Y杨宗纬",
|
||||
"v": "杨宗纬演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z郑秀文",
|
||||
"v": "郑秀文演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z周杰伦",
|
||||
"v": "周杰伦演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张学友",
|
||||
"v": "张学友演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张信哲",
|
||||
"v": "张信哲演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张宇",
|
||||
"v": "张宇演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z周华健",
|
||||
"v": "周华健演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张韶涵",
|
||||
"v": "张韶涵演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z周深",
|
||||
"v": "周深演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z纵贯线",
|
||||
"v": "纵贯线演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z赵雷",
|
||||
"v": "赵雷演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z周传雄",
|
||||
"v": "周传雄演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张国荣",
|
||||
"v": "张国荣演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z周慧敏",
|
||||
"v": "周慧敏演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张惠妹",
|
||||
"v": "张惠妹演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z周笔畅",
|
||||
"v": "周笔畅演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z郑中基",
|
||||
"v": "郑中基演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张艺兴",
|
||||
"v": "张艺兴演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张震岳",
|
||||
"v": "张震岳演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z张雨生",
|
||||
"v": "张雨生演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z郑智化",
|
||||
"v": "郑智化演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z卓依婷",
|
||||
"v": "卓依婷演唱会超清"
|
||||
},
|
||||
{
|
||||
"n": "Z中岛美雪",
|
||||
"v": "中岛美雪演唱会超清"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "duration",
|
||||
"name": "时长",
|
||||
"value": [{
|
||||
"n": "全部",
|
||||
"v": "0"
|
||||
},
|
||||
{
|
||||
"n": "60分钟以上",
|
||||
"v": "4"
|
||||
},
|
||||
{
|
||||
"n": "30~60分钟",
|
||||
"v": "3"
|
||||
},
|
||||
{
|
||||
"n": "10~30分钟",
|
||||
"v": "2"
|
||||
},
|
||||
{
|
||||
"n": "10分钟以下",
|
||||
"v": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"规则名": "爱你短剧",
|
||||
"规则作者": "香雅情",
|
||||
"请求头参数": "MOBILE_UA",
|
||||
"网页编码格式": "UTF-8",
|
||||
"图片是否需要代理": "否",
|
||||
"是否开启获取首页数据": "是",
|
||||
"首页推荐链接": "https://ainidj.com/",
|
||||
"首页列表数组规则": "body&&.module-items",
|
||||
"首页片单列表数组规则": ".module-item:lt(12)",
|
||||
"首页片单是否Jsoup写法": "1",
|
||||
"分类起始页码": "1",
|
||||
"分类链接": "https://ainidj.com/vodshwo/{cateId}--------{catePg}---.html",
|
||||
"分类名称": "穿越&战神&重生&爱情&萌娃&神医&古代&玄幻&言情",
|
||||
"分类名称替换词": "fenle&fenlei2&fenlei3&fenlei4&guda&shenyi&gudai&xuanhuan&yanqing",
|
||||
"筛选数据": {},
|
||||
//"筛选数据": "ext",
|
||||
//{cateId}
|
||||
"筛选子分类名称": "",
|
||||
"筛选子分类替换词": "",
|
||||
//{class}
|
||||
"筛选类型名称": "",
|
||||
"筛选类型替换词": "*",
|
||||
//{area}
|
||||
"筛选地区名称": "",
|
||||
"筛选地区替换词": "*",
|
||||
//{year}
|
||||
"筛选年份名称": "",
|
||||
"筛选年份替换词": "*",
|
||||
//{lang}
|
||||
"筛选语言名称": "",
|
||||
"筛选语言替换词": "*",
|
||||
//{by}
|
||||
"筛选排序名称": "时间&人气&评分",
|
||||
"筛选排序替换词": "time&hits&score",
|
||||
"分类截取模式": "1",
|
||||
"分类列表数组规则": ".module-items&&.module-item",
|
||||
"分类片单是否Jsoup写法": "是",
|
||||
"分类片单标题": ".video-name&&Text",
|
||||
"分类片单链接": "a&&href",
|
||||
"分类片单图片": ".lazy&&data-src",
|
||||
"分类片单副标题": ".module-item-text&&Text",
|
||||
"分类片单链接加前缀": "https://ainidj.com",
|
||||
"分类片单链接加后缀": "",
|
||||
"搜索请求头参数": "User-Agent$MOBILE_UA",
|
||||
"搜索链接": "https://ainidj.com/vodsearch/{wd}----------{SearchPg}---.html",
|
||||
"POST请求数据": "",
|
||||
"搜索截取模式": "1",
|
||||
"搜索列表数组规则": ".module-items&&.module-search-item",
|
||||
"搜索片单是否Jsoup写法": "是",
|
||||
"搜索片单图片": ".lazyload&&data-src",
|
||||
"搜索片单标题": ".video-info&&h3&&Text",
|
||||
"搜索片单链接": "a&&href",
|
||||
"搜索片单副标题": ".video-serial&&Text",
|
||||
"搜索片单链接加前缀": "https://ainidj.com",
|
||||
"搜索片单链接加后缀": "",
|
||||
"链接是否直接播放": "否",
|
||||
"直接播放链接加前缀": "",
|
||||
"直接播放链接加后缀": "",
|
||||
"直接播放直链视频请求头": "",
|
||||
"详情是否Jsoup写法": "是",
|
||||
"类型详情": "",
|
||||
"年代详情": "",
|
||||
"地区详情": "",
|
||||
"演员详情": "",
|
||||
"简介详情": ".video-info-main&&.video-info-content&&Text",
|
||||
"线路列表数组规则": ".module-tab-items&&.module-tab-item",
|
||||
"线路标题": "Text",
|
||||
"播放列表数组规则": "body&&.module-player-list",
|
||||
"选集列表数组规则": ".scroll-content&&a",
|
||||
"选集标题链接是否Jsoup写法": "是",
|
||||
"选集标题": "a&&Text",
|
||||
"选集链接": "a&&href",
|
||||
"是否反转选集序列": "否",
|
||||
"选集链接加前缀": "https://ainidj.com",
|
||||
"选集链接加后缀": "",
|
||||
"分析MacPlayer": "否",
|
||||
"是否开启手动嗅探": "否",
|
||||
"手动嗅探视频链接关键词": ".mp4#.m3u8#.flv#video/tos",
|
||||
"手动嗅探视频链接过滤词": ".html#=http"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
dmFyIHJ1bGU9ewp0aXRsZTogJ+iMtuadr+eLkCcsCmhvc3Q6ICdodHRwczovL3d3dy41amNkLmNvbScsCnVybDogJy9zaG93X2Z5ZmlsdGVyLmh0bWwnLApzZWFyY2hVcmw6ICcvc291L3BhZ2UvZnlwYWdlL3dkLyoqLmh0bWwnLApzZWFyY2hhYmxlOiAyLHF1aWNrU2VhcmNoOiAwLGZpbHRlcmFibGU6IDEsCmhlYWRlcnM6IHsnVXNlci1BZ2VudCc6ICdNT0JJTEVfVUEnfSwKZmlsdGVyX3VybDogJ3t7ZmwuYXJlYX19e3tmbC5ieX19e3tmbC5jbGFzc319e3tmbC5jYXRlSWR9fS9wYWdlL2Z5cGFnZXt7ZmwueWVhcn19JywKZmlsdGVyX2RlZjogewonL2lkLzEnOiB7Y2F0ZUlkOiAnL2lkLzEnfSwnL2lkLzInOiB7Y2F0ZUlkOiAnL2lkLzInfSwnL2lkLzMnOiB7Y2F0ZUlkOiAnL2lkLzMnfSwnL2lkLzQnOiB7Y2F0ZUlkOiAnL2lkLzQnfX0sCmNsYXNzX25hbWU6ICfnlLXlvbEm5Ymn6ZuGJue7vOiJuibliqjmvKsnLApjbGFzc191cmw6ICcvaWQvMSYvaWQvMiYvaWQvMyYvaWQvNCcsCmxhenk6ICcnLArmjqjojZA6ICcqJyxkb3VibGU6IHRydWUsCuS4gOe6pzogJy5teXVpLXZvZGxpc3QgbGk7YSYmdGl0bGU7YSYmZGF0YS1vcmlnaW5hbDsucGljLXRleHQmJlRleHQ7YSYmaHJlZicsCuS6jOe6pzogewp0aXRsZTogJy5teXVpLWNvbnRlbnRfX2RldGFpbCAudGl0bGUmJlRleHQ7Lm15dWktY29udGVudF9fZGV0YWlsIHA6ZXEoLTIpJiZUZXh0JywKaW1nOiAnLm15dWktY29udGVudF9fdGh1bWIgLmxhenlsb2FkJiZkYXRhLW9yaWdpbmFsJywKZGVzYzogJy5teXVpLWNvbnRlbnRfX2RldGFpbCBwOmVxKDApJiZUZXh0Oy5teXVpLWNvbnRlbnRfX2RldGFpbCBwOmVxKDEpJiZUZXh0Oy5teXVpLWNvbnRlbnRfX2RldGFpbCBwOmVxKDIpJiZUZXh0JywKY29udGVudDogJy5jb250ZW50JiZUZXh0JywKdGFiczonLm15dWktcGFuZWwtYm94LmNsZWFyZml4IGgzOm5vdCg6Y29udGFpbnMo54Ot5pKtKSknLApsaXN0czogJy5teXVpLWNvbnRlbnRfX2xpc3Q6ZXEoI2lkKSBhJ30sCuaQnOe0ojogJyNzZWFyY2hMaXN0IGxpO2EmJnRpdGxlOy5sYXp5bG9hZCYmZGF0YS1vcmlnaW5hbDsudGV4dC1tdXRlZCYmVGV4dDthJiZocmVmOy5kZXRhaWwmJnA6ZXEoMikmJlRleHQnLApmaWx0ZXI6J0g0c0lBQUFBQUFBQUErMVozVTRiT1JTKzcyUGtHaW1lL1BEVE45aG5XRldyZEJ1cHFDMHJGWFpYcUtyVUxVMUlRcGNRQktGWkFnRzFJY0FTT2lrc0M1T0d2RXpzU2Q1aVo4YU9mWHlNbXFrVTlhS2JTNzd6Y1d4L3gvYjVuSGtSaWM0L2lscVIreisraUR4SkwwZnVSMzVPTGFWL2VCU1ppaXlrbnFXOXY5MVdtKzZ2ZVgvL2xucjZhem9nTG1pdzkwZms1WlJBblZQYTJYYnpxeUxnSjA5WU1rd0x4NzFPMWQzNmgzWmFnQkVIakhLVjVoc21JNjZHeUxYWVNzWmtKQlNqVWFJM2JaT1JsQXoyeHdaN1ZUWVowNUxSYng3UnQ2Y21ZMGJseUwzck9YbVRNYXZXa20vY09kTTVsZVAxbVZzdUdZd0VVVG5xcTNldEplbk45SUhQRVRWN21scGNWQ1hqQXhzbFV6QXNHVmQ4bUR2SUZCV1lMcmxPRVppdXFFNFJtRjU4TkJESDlNcWhnVGltaTRxeWNFeXZESm9MeC9UeTZoU0J5YmtVUHJvZFJCRVlXSkc3MVRaVzVHTjYvUkNGWTNLNnphUGU3UUdhTHNka2x1em1vSEtDc25CTVp0ay85ZGFJc25CTTMyMkl3akZKV1NtdzEzOGhDc2VrTHUwaXpWd2pYVGcycEF6Mk50bTd1azRSbUJ5b3ZOclBPMmdnanNsRkZ6LzAzK05LYzB4UzFyTzArQWxST0NZcjNkM3dTb0lxelRHbGJwWHRsYkM2QVFZUFdlcDVPZ1hPV05XbWJ4M3pqRWxZTzJNZkdvTktkamlDbnlncUlDblpVWVZkZjlRWUFsSnkyT3ptVnMvQklWbVoyM1c2MjlFWUFwS3FYMnhqaG9Da1hHc3R6QkNRekxGVFo5VXpQUWVINUZwcUp6aUhnT1JhYnYvRkRBR3BtZHJtVEcwdHg1ODJkWTcwSEJ5U09kNFVQWlZwN2tSUEkxRzU1bnJYTFRiZGZFVmZ0a1RWY1Q5Z2ExM3ZuL1ZCSlFvM3kzSTY5UnhzbHB2TFhydGpiaFlKdzgwU0k3SEVjQVEvVFRRQVFEU09vM0VZamVGb0RFWXRITFZnbE9Bb0FWRnJEa1d0T1JpZHhkRlpHSjNCMFJrWW5jYlJhUmhONG1nU1JyRldGdFRLd2xwWlVDc0xhMlZCclN5c2xRVzFzckJXRnRTS1lLMEkxSXBnclFqVWltQ3RDTlNLWUswSTFJcGdyUWpVaW1DdENOU0tZSzBJMUlwZ3JRalVpbUN0Q05TS1lLMDhBQjZXaDh2cXFMRDFUZW9VamFPaVlIaFUyTTdWWU9keW1QemhjblJwM2tzaXoydnB1T2M0ek40Q2hNZnpTNHMvL1o1T1AxRTVxcm03V2M5K1dWaDY3TS96d2RTOXdIVEZ4dVdTdld1czV6U0E2L0pkb1pMVHZ5eTFXRUxGL0F0ZGo2a2llZDBDeFJKQXFUcUtxWTNodFJFVVUxdkt2M1QxMk16NG5PZm9CaC9DeW9Vd0d5RXNMajIvb2s0VFVUajJkWVp3bE1VTllRaERXTndReGllRVQvdVM4UmxTdHJPR3JSU1lIS2hUTXRRVm1NeVN1ZXExMGV0QVlPTnlXTm1NRjlBYk00ZkN1NUp4ZUxEUjdpaU1TeHZsZlVLNHRMTHRHUk82ZDZpbmtlamRsZUVyTWdzemNUTVROek54TTkrWG00bVB6YzBFTDFtMy9Sazg2UDJmcUdKZ1lYWHZxalVadW5VcDJpWURHSml6aG5kTm1vemsyT3pJb0hiUnU5bEFSb0pqNnVlUkRIdFRRM2FFWS9KcVB1LzI3WnhPRVpqTXN0bGtCZVJZQktZVXk3QnIxTHdGQnZySTREMmFpOEFreFRtbDUvdUl3akZKMmFxeFMveUxHOGUrV1dmbXhkY2JGWWYwRFlTN3FnL3AyME5uY0dqU3h5WjliTkxIdnQ4K2xoanpxN3h3ekQ3L0RSKzhzL0FhOHB5OHlaaEQxNURCU0lJUE9vRzdOaG5XMlBwWWlJOG83a3F6Zi9nS1VUZ21WN0t4NzU3aGp3VWNVemY3Nks4U0I0ZDBGejJyQmZZVmIyWldkY3h2R3h5VGJYZjB6L3doZmt1Z2RvbldMOUJjT0taZTNqV2EyMFVVamcwcFBlY1RiU0lqSVRCWmdOMENxNkRQSHdKVHVyUm9kd2ZyRW1EajZzekJodGM3TTRmQ3YyYS8wSGNuTDh4Slo1NTA1djlqWjc3MzhqL3lZcDFMVnlJQUFBPT0nCn0=
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
|
||||
"作者":"天天开心",
|
||||
|
||||
"站名":"茶狐杯",
|
||||
|
||||
"主页url":"https://www.5jcd.com/",
|
||||
|
||||
"简介":"+col-pd\">&&</p>",
|
||||
|
||||
"线路数组":"<h3&&</h3>",
|
||||
|
||||
"线路标题":"+>&&",
|
||||
|
||||
"分类url":"https://www.5jcd.com/show_/area/{area}/by/{by}/class/{class}/id/{cateId}/lang/{lang}/page/{catePg}/year/{year}.html;;ax",
|
||||
|
||||
"分类":"电影$1#电视剧$2#综艺$3#动漫$4"}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
|
||||
var rule = {
|
||||
title: '蓝莓短剧',
|
||||
host: 'https://app.whjzjx.cn',
|
||||
url: '/v1/theater/home_page?theater_class_id=1&class2_id=fyclass&page_num=fypage&page_size=24',
|
||||
searchUrl: '/?**',
|
||||
searchable: 2,
|
||||
quickSearch: 1,
|
||||
// filterable: 1,
|
||||
class_name: '七星✡︎古装&七星✡︎穿越&七星✡︎逆袭&七星✡︎重生',
|
||||
class_url: '5&17&7&6',
|
||||
一级: $js.toString(() => {
|
||||
let d = [];
|
||||
let urlk = `https://app.whjzjx.cn/v1/theater/home_page?theater_class_id=${MY_CATE}&page_num=${MY_PAGE - 1}&page_size=24`;
|
||||
let tkurl = 'https://app.whjzjx.cn/v1/account/login';
|
||||
let head = JSON.parse(post(tkurl, {
|
||||
headers: {
|
||||
"Connection": "keep-alive",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Content-Length": "40",
|
||||
"user-agent": "okhttp/4.10.0",
|
||||
"user_agent": "Mozilla/5.0 (Linux; Android 9; ASUS_I003DD Build/PI; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.70 Mobile Safari/537.36",
|
||||
"Host": "app.whjzjx.cn",
|
||||
"Accept-Encoding": "gzip"
|
||||
},
|
||||
body: "device=20caaae96b3443174bf4ebdbdcc253776"
|
||||
})).data.token;
|
||||
let header={"authorization":head};
|
||||
let html = JSON.parse(request(urlk, {
|
||||
headers: header
|
||||
}));
|
||||
let bata = html.data.list;
|
||||
bata.forEach(it => {
|
||||
let id = 'https://app.whjzjx.cn/v2/theater_parent/detail?theater_parent_id=' + it.theater.id;
|
||||
d.push({
|
||||
url: id,
|
||||
title: it.theater.title,
|
||||
img: it.theater.cover_url,
|
||||
desc: it.theater.total + "集",
|
||||
content: "播放量:" + it.theater.play_amount_str,
|
||||
});
|
||||
});
|
||||
setResult(d);
|
||||
}),
|
||||
二级: $js.toString(() => {
|
||||
let urls = [];
|
||||
let tkurl = 'https://app.whjzjx.cn/v1/account/login';
|
||||
let head = JSON.parse(post(tkurl, {
|
||||
headers: {
|
||||
"Connection": "keep-alive",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Content-Length": "40",
|
||||
"user-agent": "okhttp/4.10.0",
|
||||
"user_agent": "Mozilla/5.0 (Linux; Android 9; ASUS_I003DD Build/PI; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.70 Mobile Safari/537.36",
|
||||
"Host": "app.whjzjx.cn",
|
||||
"Accept-Encoding": "gzip"
|
||||
},
|
||||
body: "device=20caaae96b3443174bf4ebdbdcc253776"
|
||||
})).data.token;
|
||||
let header={"authorization":head};
|
||||
let data = JSON.parse(request(input, {
|
||||
headers: header
|
||||
})).data;
|
||||
//console.log(data);
|
||||
data.theaters.forEach(it => {
|
||||
urls.push("第" + it.num + "集" + '$' + it.son_video_url);
|
||||
});
|
||||
VOD = {
|
||||
vod_name: data.title,
|
||||
vod_pic: data.cover_url,
|
||||
vod_remarks: data.total + "集",
|
||||
vod_play_from: '七星✡︎短剧',
|
||||
vod_play_url: urls.join('#')
|
||||
};
|
||||
}),
|
||||
搜索: $js.toString(() => {
|
||||
let d = [];
|
||||
let ht = input.match(/\?(.*)/)[1];
|
||||
let ser = "https://app.whjzjx.cn/v2/search";
|
||||
let tkurl = 'https://app.whjzjx.cn/v1/account/login';
|
||||
let head = JSON.parse(post(tkurl, {
|
||||
headers: {
|
||||
"Connection": "keep-alive",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Content-Length": "40",
|
||||
"user-agent": "okhttp/4.10.0",
|
||||
"user_agent": "Mozilla/5.0 (Linux; Android 9; ASUS_I003DD Build/PI; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.70 Mobile Safari/537.36",
|
||||
"Host": "app.whjzjx.cn",
|
||||
"Accept-Encoding": "gzip"
|
||||
},
|
||||
body: "device=20caaae96b3443174bf4ebdbdcc253776"
|
||||
})).data.token;
|
||||
let header={"authorization":head};
|
||||
let html = JSON.parse(post(ser, {
|
||||
headers: header,
|
||||
body: "text=" + ht
|
||||
}));
|
||||
let bata = html.data.search_data;
|
||||
bata.forEach(it => {
|
||||
let id = 'https://app.whjzjx.cn/v2/theater_parent/detail?theater_parent_id=' + it.id;
|
||||
d.push({
|
||||
url: id,
|
||||
title: it.title,
|
||||
img: it.cover_url,
|
||||
desc: it.score_str + "|" + it.total + "集",
|
||||
});
|
||||
});
|
||||
setResult(d);
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
LyoqCiAqIOW8uueDiOaOqOiNkOmdmeaAgeWIhuexu+OAguWPr+S7peWKoOW/q+mAn+W6piEhIQogKiDkuI3lu7rorq46CiAqIOS8oOWPgiA/dHlwZT11cmwmcGFyYW1zPS4uL2pzb24v6YeH6ZuGLmpzb24KICog5bu66K6u77yaCiAqIOS8oOWPgiA/dHlwZT11cmwmcGFyYW1zPS4uL2pzb24v6YeH6ZuG6Z2Z5oCBLmpzb24kMQogKiDkvKDlj4IgP3R5cGU9dXJsJnBhcmFtcz0uLi9qc29uL+mHh+mbhlt6eV3pnZnmgIEuanNvbiQxCiAqIOS8oOWPgiA/dHlwZT11cmwmcGFyYW1zPS4uL2pzb24v6YeH6ZuGW+Wvhl3pnZnmgIEuanNvbiQxCiAqIGhpcHktc2VydmVy5pSv5oyBQOaUueWQjeavlOWmgjoKICog5Lyg5Y+CID90eXBlPXVybCZwYXJhbXM9Li4vanNvbi/ph4fpm4bpnZnmgIEuanNvbiQxQOmHh+eOi+mBk+mVv1vlkIhdCiAqIOS8oOWPgiA/dHlwZT11cmwmcGFyYW1zPS4uL2pzb24v6YeH6ZuGW3p5XemdmeaAgS5qc29uJDFA6YeH546Lenlb5a+GXQogKiDkvKDlj4IgP3R5cGU9dXJsJnBhcmFtcz0uLi9qc29uL+mHh+mbhlvlr4Zd6Z2Z5oCBLmpzb25A6YeH546L5oiQ5Lq6W+Wvhl0KICogW3sibmFtZSI6IuaatOmjjui1hOa6kCIsInVybCI6Imh0dHBzOi8vYmZ6eWFwaS5jb20iLCJwYXJzZV91cmwiOiIifSx7Im5hbWUiOiLpo57liIDotYTmupAiLCJ1cmwiOiJodHRwOi8vd3d3LmZlaWRhb3p5LmNvbSIsInBhcnNlX3VybCI6IiJ9LHsibmFtZSI6Ium7keacqOiAs+i1hOa6kCIsInVybCI6Imh0dHBzOi8vd3d3LmhlaW11ZXIudHYiLCJwYXJzZV91cmwiOiIifV0KICovCmdsb2JhbFRoaXMuZ2V0UmFuZG9tSXRlbSA9IGZ1bmN0aW9uIChpdGVtcykgey8v5LuO5YiX6KGo6ZqP5py65Y+W5Ye65LiA5Liq5YWD57SgCiAgICByZXR1cm4gaXRlbXNbTWF0aC5yYW5kb20oKSAqIGl0ZW1zLmxlbmd0aCB8IDBdOwp9CnZhciBydWxlID0gewogICAgdGl0bGU6ICfph4fpm4bkuYvnjotb5ZCIXScsCiAgICBhdXRob3I6ICfpgZPplb8nLAogICAgdmVyc2lvbjogJzIwMjQwNzA2IGJldGExNycsCiAgICB1cGRhdGVfaW5mbzogYAoyMDI0MDcwNjoKMS7pnZnmgIFqc29u5pWw5o2u5pSv5oyBY2F0ZV9leGNsdWRlc+WIhuexu+WQjeensOWIl+ihqOi/h+a7pOaXoOaVsOaNruWIhuexuwoyLuabtOaWsOmHh+mbhuWIhuexu+eUn+aIkOWZqOWinuWKoOi/h+a7pOetm+mAieaooeW8jwoyMDI0MDcwNToKMS7mlK/mjIHkvKDlj4Jqc29u5ZCO6Z2i5aKe5YqgJDEg6L+Z5qC355qE6aKd5aSW5qCH6K+G77yM55So5LqO5pCc57Si57uT5p6c57K+5YeG5Yy56YWNCjIu5pSv5oyB5Lyg5Y+CanNvbuWQjumdouWinuWKoCQxJDEg6L+Z5qC355qE6aKd5aSW5qCH6K+G77yM55So5LqO5by65Yi26I635Y+W5pCc57Si5Zu+54mH44CCJDEk5LiN5pi+56S65Zu+54mH44CC6buY6K6k5piv5pCc57Si5by65Yi25pyJ5Zu+54mH55qEW+W3suWunueOsOivpuaDhemhteivt+axguS9v+eUqOaJuemHj10KMy7kv67lpI3kuoznuqfmlbDmja7ml6Dluo/ljLnphY3mkJzntKLliJfooajlm77niYfnmoTpl67popgKNC7kv67mlLnmkJzntKLnsr7lh4blkozlm77niYfmmL7npLrpop3lpJblj4LmlbDpl7TpmpTnrKbku44j5Y+Y5Li6JAoyMDI0MDcwMzoKMS7ph4fpm4Zqc29u5pSv5oyBInNlYXJjaGFibGUiOiAwLOeUqOS6juaQnOe0ouaXtuaOkumZpOi/meS4qua6kAoyMDI0MDYwNDoKMS7pppbpobXmjqjojZDlj5bmtojnoazmjqfnrYnlvoXjgILlop7liqDpmo/mnLrmjqjojZDlip/og73jgIIKMi7pppbpobXmjqjojZDmlrDlop7mm7TmlrDml6Xlv5fmn6XnnIvlip/og70K44CQ54m55Yir6K+05piO44CR55uu5YmN5Y+q5pSv5oyB5qCH5YeGanNvbuagvOW8j+eahOmHh+mbhuermSjotYTmupDnq5nkuIDoiKzpg73mj5Dkvpt4bWzlkoxqc29u5Lik56eN5o6l5Y+j77yM55uu5YmN5rKh5pyJ5pSv5oyBeG1s55qE5oOz5rOV77yM5rKh5LuA5LmI5b+F6KaBKQrmnInkupvotYTmupDnq5nnmoRqc29u5o6l5Y+j5LiN5piv5qCH5YeG55qEL2FwaS5waHAvcHJvdmlkZS92b2QvLOmcgOimgeiHquW3seWcqOmHh+mbhumdmeaAgS5qc29u5Lit57yW6L6R5a+55bqU55qEYXBp5bGe5oCn5aGr5YaZ5q+U5aaCOi9hcGkucGhwL3Byb3ZpZGUvdm9kL2F0L2pzb24vCuacieS6m+i1hOa6kOermeeahOmHh+mbhuaVsOaNruaYr+WKoOWvhuWQjueahOWIh+eJh+eJh+aute+8jOWPr+iDvemcgOimgemHh+mbhuermeeJueWumueahOino+aekOaOpeWPo++8jOmcgOimgeiHquW3see8lui+kWpzb27ph4znmoRwYXJzZV91cmzlsZ7mgKcK6LWE5rqQ56uZ6YOo5YiG5aSn5YiG57G75LiL5peg5pWw5o2u5b6I5q2j5bi477yM5Y+v5Lul6Ieq6KGM57yW6L6RanNvbumHjGNhdGVfZXhjbHVkZeWxnuaAp+aOkumZpOaOieiHquW3sea1i+ivlei/h+aXoOaVsOaNrueahOWIhuexuyjlsI/nqIvluo/ml6Dms5Xoh6rliqjor4bliKvvvIzlj6rog73kurrlt6XmtYvlpb3lk6rkupvliIbnsbvml6DmlbDmja4pCmAudHJpbSgpLAogICAgaG9zdDogJycsCiAgICBob21lVGlkOiAnJywgLy8g6aaW6aG15o6o6I2Q44CC5LiA6Iis5aGr5YaZ56ys5LiA5Liq6LWE5rqQ56uZ55qE5oOz6KaB55qE5o6o6I2Q5YiG57G755qEaWQu5Y+v5Lul56m6CiAgICBob21lVXJsOiAnL2FwaS5waHAvcHJvdmlkZS92b2QvP2FjPWRldGFpbCZ0PXt7cnVsZS5ob21lVGlkfX0nLAogICAgZGV0YWlsVXJsOiAnL2FwaS5waHAvcHJvdmlkZS92b2QvP2FjPWRldGFpbCZpZHM9ZnlpZCcsCiAgICBzZWFyY2hVcmw6ICcvYXBpLnBocC9wcm92aWRlL3ZvZC8/d2Q9KiomcGc9I1RydWVQYWdlIyNwYWdlPWZ5cGFnZScsCiAgICBjbGFzc1VybDogJy9hcGkucGhwL3Byb3ZpZGUvdm9kLycsCiAgICB1cmw6ICcvYXBpLnBocC9wcm92aWRlL3ZvZC8/YWM9ZGV0YWlsJnBnPWZ5cGFnZSZ0PWZ5ZmlsdGVyJywKICAgIGZpbHRlcl91cmw6ICd7e2ZsLuexu+Wei319JywKICAgIGhlYWRlcnM6IHsnVXNlci1BZ2VudCc6ICdNT0JJTEVfVUEnfSwKICAgIHRpbWVvdXQ6IDUwMDAsIC8vIGNsYXNzX25hbWU6ICfnlLXlvbEm55S16KeG5YmnJue7vOiJuibliqjmvKsnLAogICAgbGltaXQ6IDIwLAogICAgc2VhcmNoX2xpbWl0OiA1LCAvLyDmkJzntKLpmZDliLblj5bliY015Liq77yM5Y+v5Lul5rOo6YeK5o6J77yM5bCx5LiN6ZmQ5Yi25pCc57SiCiAgICBzZWFyY2hhYmxlOiAxLC8v5piv5ZCm5ZCv55So5YWo5bGA5pCc57SiLAogICAgcXVpY2tTZWFyY2g6IDAsLy/mmK/lkKblkK/nlKjlv6vpgJ/mkJzntKIsCiAgICBmaWx0ZXJhYmxlOiAxLC8v5piv5ZCm5ZCv55So5YiG57G7562b6YCJLAogICAgcGxheV9wYXJzZTogdHJ1ZSwKICAgIHBhcnNlX3VybDogJycsIC8vIOi/meS4quWPguaVsOaaguaXtuS4jei1t+S9nOeUqOOAguiBmuWQiOexu+eahOavj+S4qui1hOa6kOW6lOivpeacieiHquW3seeLrOeri+eahOino+aekOWPo+OAguWNleeLrOmFjee9ruWcqOmHh+mbhi5qc29u6YeM55qEcGFyc2VfdXJs5pyJ5pWICiAgICBzZWFyY2hfbWF0Y2g6IGZhbHNlLCAvLyDmkJzntKLnsr7lh4bljLnphY0KICAgIHNlYXJjaF9waWM6IHRydWUsIC8vIOaQnOe0ouW8uuWItumcgOimgeWbvueJhwogICAgLy8gcGFyYW1zOiAnaHR0cDovLzEyNy4wLjAuMTo1NzA3L2ZpbGVzL2pzb24vJUU5JTg3JTg3JUU5JTlCJTg2Lmpzb24nLAogICAgLy8gcGFyYW1zOiAnaHR0cDovLzEyNy4wLjAuMTo1NzA3L2ZpbGVzL2pzb24v6YeH6ZuG6Z2Z5oCBLmpzb24kMScsCiAgICAvLyBwYXJhbXM6ICdodHRwOi8vMTI3LjAuMC4xOjU3MDcvZmlsZXMvanNvbi/ph4fpm4Zbenld6Z2Z5oCBLmpzb24kMScsCiAgICAvLyBob3N0SnM6JGpzLnRvU3RyaW5nKCgpPT57CiAgICAvLwogICAgLy8gfSksCiAgICDpooTlpITnkIY6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgZnVuY3Rpb24gZ2V0Q2xhc3NlcyhpdGVtKSB7CiAgICAgICAgICAgIGxldCBjbGFzc2VzID0gW107CiAgICAgICAgICAgIGlmIChpdGVtLmNsYXNzX25hbWUgJiYgaXRlbS5jbGFzc191cmwpIHsKICAgICAgICAgICAgICAgIGlmICghLyZ855S15b2xfOeUteinhuWJp3znu7zoibp85Yqo5ryrW1x1NEUwMC1cdTlGQTVdKy8udGVzdChpdGVtLmNsYXNzX25hbWUpKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaXRlbS5jbGFzc19uYW1lID0gdW5nemlwKGl0ZW0uY2xhc3NfbmFtZSkKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhg5LiN6K+G5Yir55qEY2xhc3NfbmFtZeWvvOiHtGd6aXDop6PnoIHlpLHotKU6JHtlfWApCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGFzc2VzCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbGV0IG5hbWVzID0gaXRlbS5jbGFzc19uYW1lLnNwbGl0KCcmJyk7CiAgICAgICAgICAgICAgICBsZXQgdXJscyA9IGl0ZW0uY2xhc3NfdXJsLnNwbGl0KCcmJyk7CiAgICAgICAgICAgICAgICBsZXQgY250ID0gTWF0aC5taW4obmFtZXMubGVuZ3RoLCB1cmxzLmxlbmd0aCk7CiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGNudDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgY2xhc3Nlcy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3R5cGVfaWQnOiB1cmxzW2ldLAogICAgICAgICAgICAgICAgICAgICAgICAndHlwZV9uYW1lJzogbmFtZXNbaV0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gY2xhc3NlcwogICAgICAgIH0KCiAgICAgICAgaWYgKHR5cGVvZiAoYmF0Y2hGZXRjaCkgPT09ICdmdW5jdGlvbicpIHsKICAgICAgICAgICAgLy8g5pSv5oyB5om56YeP6K+35rGC55u05o6l5pS+6aOe6Ieq5oiR44CC5pCc57Si6ZmQ5Yi25pyA5aSn57q/56iL5pWw6YePMTYKICAgICAgICAgICAgcnVsZS5zZWFyY2hfbGltaXQgPSAxNjsKICAgICAgICAgICAgbG9nKCflvZPliY3nqIvluo/mlK/mjIHmibnph4/or7fmsYJbYmF0Y2hGZXRjaF0s5pCc57Si6ZmQ5Yi25bey6K6+572u5Li6MTYnKTsKICAgICAgICB9CiAgICAgICAgbGV0IF91cmwgPSBydWxlLnBhcmFtczsKICAgICAgICBsb2coYOS8oOWFpeWPguaVsDoke191cmx9YCk7CiAgICAgICAgaWYgKF91cmwgJiYgdHlwZW9mIChfdXJsKSA9PT0gJ3N0cmluZycgJiYgL14oaHR0cHxmaWxlKS8udGVzdChfdXJsKSkgewogICAgICAgICAgICBpZiAoX3VybC5pbmNsdWRlcygnJCcpKSB7CiAgICAgICAgICAgICAgICBsZXQgX3VybF9wYXJhbXMgPSBfdXJsLnNwbGl0KCckJyk7CiAgICAgICAgICAgICAgICBfdXJsID0gX3VybF9wYXJhbXNbMF07CiAgICAgICAgICAgICAgICBydWxlLnNlYXJjaF9tYXRjaCA9ICEhKF91cmxfcGFyYW1zWzFdKTsKICAgICAgICAgICAgICAgIGlmIChfdXJsX3BhcmFtcy5sZW5ndGggPiAyKSB7IC8vIOW8uuWItuWbvueJhwogICAgICAgICAgICAgICAgICAgIHJ1bGUuc2VhcmNoX3BpYyA9ICEhKF91cmxfcGFyYW1zWzJdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoX3VybCk7CiAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKICAgICAgICAgICAgbGV0IF9jbGFzc2VzID0gW107CiAgICAgICAgICAgIHJ1bGUuZmlsdGVyID0ge307CiAgICAgICAgICAgIHJ1bGUuZmlsdGVyX2RlZiA9IHt9OwogICAgICAgICAgICBqc29uLmZvckVhY2goaXQgPT4gewogICAgICAgICAgICAgICAgbGV0IF9vYmogPSB7CiAgICAgICAgICAgICAgICAgICAgdHlwZV9uYW1lOiBpdC5uYW1lLAogICAgICAgICAgICAgICAgICAgIHR5cGVfaWQ6IGl0LnVybCwKICAgICAgICAgICAgICAgICAgICBwYXJzZV91cmw6IGl0LnBhcnNlX3VybCB8fCAnJywKICAgICAgICAgICAgICAgICAgICBzZWFyY2hhYmxlOiBpdC5zZWFyY2hhYmxlICE9PSAwLAogICAgICAgICAgICAgICAgICAgIGFwaTogaXQuYXBpIHx8ICcnLAogICAgICAgICAgICAgICAgICAgIGNhdGVfZXhjbHVkZTogaXQuY2F0ZV9leGNsdWRlIHx8ICcnLAogICAgICAgICAgICAgICAgICAgIGNhdGVfZXhjbHVkZXM6IGl0LmNhdGVfZXhjbHVkZXMgfHwgW10sCiAgICAgICAgICAgICAgICAgICAgLy8gY2xhc3NfbmFtZTogaXQuY2xhc3NfbmFtZSB8fCAnJywKICAgICAgICAgICAgICAgICAgICAvLyBjbGFzc191cmw6IGl0LmNsYXNzX3VybCB8fCAnJywKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBfY2xhc3Nlcy5wdXNoKF9vYmopOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBsZXQganNvbjEgPSBbXTsKICAgICAgICAgICAgICAgICAgICBpZiAoaXQuY2xhc3NfbmFtZSAmJiBpdC5jbGFzc191cmwpIHsKICAgICAgICAgICAgICAgICAgICAgICAganNvbjEgPSBnZXRDbGFzc2VzKGl0KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBqc29uMSA9IEpTT04ucGFyc2UocmVxdWVzdCh1cmxqb2luKF9vYmoudHlwZV9pZCwgX29iai5hcGkgfHwgcnVsZS5jbGFzc1VybCkpKS5jbGFzczsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKF9vYmouY2F0ZV9leGNsdWRlcyAmJiBBcnJheS5pc0FycmF5KF9vYmouY2F0ZV9leGNsdWRlcykgJiYgX29iai5jYXRlX2V4Y2x1ZGVzLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAganNvbjEgPSBqc29uMS5maWx0ZXIoY2wgPT4gIV9vYmouY2F0ZV9leGNsdWRlcy5pbmNsdWRlcyhjbC50eXBlX25hbWUpKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKF9vYmouY2F0ZV9leGNsdWRlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGpzb24xID0ganNvbjEuZmlsdGVyKGNsID0+ICFuZXcgUmVnRXhwKF9vYmouY2F0ZV9leGNsdWRlLCAnaScpLnRlc3QoY2wudHlwZV9uYW1lKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJ1bGUuZmlsdGVyW19vYmoudHlwZV9pZF0gPSBbewogICAgICAgICAgICAgICAgICAgICAgICAia2V5IjogIuexu+WeiyIsICJuYW1lIjogIuexu+WeiyIsICJ2YWx1ZSI6IGpzb24xLm1hcChpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7Im4iOiBpLnR5cGVfbmFtZSwgJ3YnOiBpLnR5cGVfaWR9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgfV07CiAgICAgICAgICAgICAgICAgICAgaWYgKGpzb24xLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgcnVsZS5maWx0ZXJfZGVmW2l0LnVybF0gPSB7Iuexu+WeiyI6IGpzb24xWzBdLnR5cGVfaWR9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICBydWxlLmZpbHRlcltpdC51cmxdID0gW3sia2V5IjogIuexu+WeiyIsICJuYW1lIjogIuexu+WeiyIsICJ2YWx1ZSI6IFt7Im4iOiAi5YWo6YOoIiwgInYiOiAiIn1dfV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBydWxlLmNsYXNzZXMgPSBfY2xhc3NlczsKICAgICAgICB9CiAgICB9KSwKICAgIC8vIGNsYXNzX3BhcnNlOiAkanMudG9TdHJpbmcoKCkgPT4gewogICAgLy8gICAgIGxldCBfdXJsID0gcnVsZS5wYXJhbXM7CiAgICAvLyAgICAgaWYgKF91cmwgJiYgdHlwZW9mIChfdXJsKSA9PT0gJ3N0cmluZycgJiYgX3VybC5zdGFydHNXaXRoKCdodHRwJykpIHsKICAgIC8vICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KF91cmwpOwogICAgLy8gICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoaHRtbCk7CiAgICAvLyAgICAgICAgIGxldCBfY2xhc3NlcyA9IFtdOwogICAgLy8gICAgICAgICBob21lT2JqLmZpbHRlciA9IHt9OwogICAgLy8gICAgICAgICBydWxlLmZpbHRlcl9kZWYgPSB7fTsKICAgIC8vICAgICAgICAganNvbi5mb3JFYWNoKGl0ID0+IHsKICAgIC8vICAgICAgICAgICAgIGxldCBfb2JqID0gewogICAgLy8gICAgICAgICAgICAgICAgIHR5cGVfbmFtZTogaXQubmFtZSwKICAgIC8vICAgICAgICAgICAgICAgICB0eXBlX2lkOiBpdC51cmwsCiAgICAvLyAgICAgICAgICAgICAgICAgcGFyc2VfdXJsOiBpdC5wYXJzZV91cmwgfHwgJycsCiAgICAvLyAgICAgICAgICAgICAgICAgY2F0ZV9leGNsdWRlOiBpdC5jYXRlX2V4Y2x1ZGUgfHwgJycsCiAgICAvLyAgICAgICAgICAgICB9OwogICAgLy8gICAgICAgICAgICAgX2NsYXNzZXMucHVzaChfb2JqKTsKICAgIC8vICAgICAgICAgICAgIHRyeSB7CiAgICAvLyAgICAgICAgICAgICAgICAgbGV0IGpzb24xID0gSlNPTi5wYXJzZShyZXF1ZXN0KHVybGpvaW4oX29iai50eXBlX2lkLCBydWxlLmNsYXNzVXJsKSkpLmNsYXNzOwogICAgLy8gICAgICAgICAgICAgICAgIGlmIChfb2JqLmNhdGVfZXhjbHVkZSkgewogICAgLy8gICAgICAgICAgICAgICAgICAgICBqc29uMSA9IGpzb24xLmZpbHRlcihjbCA9PiAhbmV3IFJlZ0V4cChfb2JqLmNhdGVfZXhjbHVkZSwgJ2knKS50ZXN0KGNsLnR5cGVfbmFtZSkpOwogICAgLy8gICAgICAgICAgICAgICAgIH0KICAgIC8vICAgICAgICAgICAgICAgICBob21lT2JqLmZpbHRlcltfb2JqLnR5cGVfaWRdID0gW3sKICAgIC8vICAgICAgICAgICAgICAgICAgICAgImtleSI6ICLnsbvlnosiLCAibmFtZSI6ICLnsbvlnosiLCAidmFsdWUiOiBqc29uMS5tYXAoaSA9PiB7CiAgICAvLyAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyJuIjogaS50eXBlX25hbWUsICd2JzogaS50eXBlX2lkfQogICAgLy8gICAgICAgICAgICAgICAgICAgICB9KQogICAgLy8gICAgICAgICAgICAgICAgIH1dOwogICAgLy8gICAgICAgICAgICAgICAgIGlmIChqc29uMS5sZW5ndGggPiAwKSB7CiAgICAvLyAgICAgICAgICAgICAgICAgICAgIHJ1bGUuZmlsdGVyX2RlZltpdC51cmxdID0geyLnsbvlnosiOiBqc29uMVswXS50eXBlX2lkfTsKICAgIC8vICAgICAgICAgICAgICAgICB9CiAgICAvLyAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAvLyAgICAgICAgICAgICAgICAgaG9tZU9iai5maWx0ZXJbaXQudXJsXSA9IFt7ImtleSI6ICLnsbvlnosiLCAibmFtZSI6ICLnsbvlnosiLCAidmFsdWUiOiBbeyJuIjogIuWFqOmDqCIsICJ2IjogIiJ9XX1dOwogICAgLy8gICAgICAgICAgICAgfQogICAgLy8gICAgICAgICB9KTsKICAgIC8vICAgICAgICAgcnVsZS5jbGFzc2VzID0gX2NsYXNzZXM7CiAgICAvLyAgICAgICAgIGlucHV0ID0gX2NsYXNzZXM7CiAgICAvLyAgICAgfQogICAgLy8gfSksCiAgICBjbGFzc19wYXJzZTogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBpbnB1dCA9IHJ1bGUuY2xhc3NlczsKICAgIH0pLAogICAg5o6o6I2QOiAkanMudG9TdHJpbmcoKCkgPT4gewogICAgICAgIGxldCB1cGRhdGVfaW5mbyA9IFt7CiAgICAgICAgICAgIHZvZF9uYW1lOiAn5pu05paw5pel5b+XJywKICAgICAgICAgICAgdm9kX2lkOiAndXBkYXRlX2luZm8nLAogICAgICAgICAgICB2b2RfcmVtYXJrczogYOeJiOacrDoke3J1bGUudmVyc2lvbn1gLAogICAgICAgICAgICB2b2RfcGljOiAnaHR0cHM6Ly9naHByb3h5Lm5ldC9odHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vaGpkaG54L2hpcHktc2VydmVyL21hc3Rlci9hcHAvc3RhdGljL2ltZy9sb2dvLnBuZycKICAgICAgICB9XTsKICAgICAgICBWT0RTID0gW107CiAgICAgICAgaWYgKHJ1bGUuY2xhc3NlcykgewogICAgICAgICAgICBsZXQgcmFuZG9tQ2xhc3MgPSBnZXRSYW5kb21JdGVtKHJ1bGUuY2xhc3Nlcyk7CiAgICAgICAgICAgIGxldCBfdXJsID0gdXJsam9pbihyYW5kb21DbGFzcy50eXBlX2lkLCBpbnB1dCk7CiAgICAgICAgICAgIGlmIChyYW5kb21DbGFzcy5hcGkpIHsKICAgICAgICAgICAgICAgIF91cmwgPSBfdXJsLnJlcGxhY2UoJy9hcGkucGhwL3Byb3ZpZGUvdm9kLycsIHJhbmRvbUNsYXNzLmFwaSkKICAgICAgICAgICAgfQogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KF91cmwsIHt0aW1lb3V0OiBydWxlLnRpbWVvdXR9KTsKICAgICAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShodG1sKTsKICAgICAgICAgICAgICAgIFZPRFMgPSBqc29uLmxpc3Q7CiAgICAgICAgICAgICAgICBWT0RTLmZvckVhY2goaXQgPT4gewogICAgICAgICAgICAgICAgICAgIGl0LnZvZF9pZCA9IHJhbmRvbUNsYXNzLnR5cGVfaWQgKyAnJCcgKyBpdC52b2RfaWQ7CiAgICAgICAgICAgICAgICAgICAgaXQudm9kX3JlbWFya3MgPSBpdC52b2RfcmVtYXJrcyArICd8JyArIHJhbmRvbUNsYXNzLnR5cGVfbmFtZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgVk9EUyA9IHVwZGF0ZV9pbmZvLmNvbmNhdChWT0RTKTsKICAgIH0pLAogICAg5LiA57qnOiAkanMudG9TdHJpbmcoKCkgPT4gewogICAgICAgIFZPRFMgPSBbXTsKICAgICAgICBpZiAocnVsZS5jbGFzc2VzKSB7CiAgICAgICAgICAgIC8vIGxvZyhpbnB1dCk7CiAgICAgICAgICAgIGxldCBfdXJsID0gdXJsam9pbihNWV9DQVRFLCBpbnB1dCk7CiAgICAgICAgICAgIGxldCBjdXJyZW50X3ZvZCA9IHJ1bGUuY2xhc3Nlcy5maW5kKGl0ZW0gPT4gaXRlbS50eXBlX2lkID09PSBNWV9DQVRFKTsKICAgICAgICAgICAgaWYgKGN1cnJlbnRfdm9kICYmIGN1cnJlbnRfdm9kLmFwaSkgewogICAgICAgICAgICAgICAgX3VybCA9IF91cmwucmVwbGFjZSgnL2FwaS5waHAvcHJvdmlkZS92b2QvJywgY3VycmVudF92b2QuYXBpKQogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChfdXJsKTsKICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGh0bWwpOwogICAgICAgICAgICBWT0RTID0ganNvbi5saXN0OwogICAgICAgICAgICBWT0RTLmZvckVhY2goaXQgPT4gewogICAgICAgICAgICAgICAgaXQudm9kX2lkID0gTVlfQ0FURSArICckJyArIGl0LnZvZF9pZAogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9KSwKICAgIC8vIOS4gOe6pzogJ2pzb246bGlzdDt2b2RfbmFtZTt2b2RfcGljO3ZvZF9yZW1hcmtzO3ZvZF9pZDt2b2RfcGxheV9mcm9tJywKICAgIOS6jOe6pzogJGpzLnRvU3RyaW5nKCgpID0+IHsKICAgICAgICBWT0QgPSB7fTsKICAgICAgICBpZiAob3JJZCA9PT0gJ3VwZGF0ZV9pbmZvJykgewogICAgICAgICAgICBWT0QgPSB7CiAgICAgICAgICAgICAgICB2b2RfY29udGVudDogcnVsZS51cGRhdGVfaW5mby50cmltKCksCiAgICAgICAgICAgICAgICB2b2RfbmFtZTogJ+abtOaWsOaXpeW/lycsCiAgICAgICAgICAgICAgICB0eXBlX25hbWU6ICfmm7TmlrDml6Xlv5cnLAogICAgICAgICAgICAgICAgdm9kX3BpYzogJ2h0dHBzOi8vcmVzb3VyY2UtY2RuLnR1eGlhb2JlaS5jb20vdmlkZW8vRnRXaHMybWV3WF83bkV1RTUxX2s2enZnNmF3bC5wbmcnLAogICAgICAgICAgICAgICAgdm9kX3JlbWFya3M6IGDniYjmnKw6JHtydWxlLnZlcnNpb259YCwKICAgICAgICAgICAgICAgIHZvZF9wbGF5X2Zyb206ICfpgZPplb/lnKjnur8nLAogICAgICAgICAgICAgICAgLy8gdm9kX3BsYXlfdXJsOiAn5ZeF5o6i5pKt5pS+JGh0dHBzOi8vcmVzb3VyY2UtY2RuLnR1eGlhb2JlaS5jb20vdmlkZW8vMTAvOGYvMTA4ZmM5ZDFhYzNmNjlkMjlhNzM4Y2RjMDk3YzkwMTgubXA0JywKICAgICAgICAgICAgICAgIHZvZF9wbGF5X3VybDogJ+maj+acuuWwj+inhumikSRodHRwOi8vYXBpLnl1am4uY24vYXBpL3p6eGpqLnBocCcsCiAgICAgICAgICAgIH07CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgaWYgKHJ1bGUuY2xhc3NlcykgewogICAgICAgICAgICAgICAgbGV0IF91cmwgPSB1cmxqb2luKGZ5Y2xhc3MsIGlucHV0KTsKICAgICAgICAgICAgICAgIGxldCBjdXJyZW50X3ZvZCA9IHJ1bGUuY2xhc3Nlcy5maW5kKGl0ZW0gPT4gaXRlbS50eXBlX2lkID09PSBmeWNsYXNzKTsKICAgICAgICAgICAgICAgIGlmIChjdXJyZW50X3ZvZCAmJiBjdXJyZW50X3ZvZC5hcGkpIHsKICAgICAgICAgICAgICAgICAgICBfdXJsID0gX3VybC5yZXBsYWNlKCcvYXBpLnBocC9wcm92aWRlL3ZvZC8nLCBjdXJyZW50X3ZvZC5hcGkpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoX3VybCk7CiAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoaHRtbCk7CiAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IGpzb24ubGlzdDsKICAgICAgICAgICAgICAgIFZPRCA9IGRhdGFbMF07CiAgICAgICAgICAgICAgICBpZiAoY3VycmVudF92b2QgJiYgY3VycmVudF92b2QudHlwZV9uYW1lKSB7CiAgICAgICAgICAgICAgICAgICAgVk9ELnZvZF9wbGF5X2Zyb20gPSBWT0Qudm9kX3BsYXlfZnJvbS5zcGxpdCgnJCQkJykubWFwKGl0ID0+IGN1cnJlbnRfdm9kLnR5cGVfbmFtZSArICd8JyArIGl0KS5qb2luKCckJCQnKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSksCiAgICDmkJzntKI6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgVk9EUyA9IFtdOwogICAgICAgIGlmIChydWxlLmNsYXNzZXMpIHsKICAgICAgICAgICAgbGV0IGNhblNlYXJjaCA9IHJ1bGUuY2xhc3Nlcy5maWx0ZXIoaXQgPT4gaXQuc2VhcmNoYWJsZSk7CiAgICAgICAgICAgIGxldCBwYWdlID0gTnVtYmVyKE1ZX1BBR0UpOwogICAgICAgICAgICBwYWdlID0gKE1ZX1BBR0UgLSAxKSAlIE1hdGguY2VpbChjYW5TZWFyY2gubGVuZ3RoIC8gcnVsZS5zZWFyY2hfbGltaXQpICsgMTsKICAgICAgICAgICAgbGV0IHRydWVQYWdlID0gTWF0aC5jZWlsKE1ZX1BBR0UgLyBNYXRoLmNlaWwoY2FuU2VhcmNoLmxlbmd0aCAvIHJ1bGUuc2VhcmNoX2xpbWl0KSk7CiAgICAgICAgICAgIGlmIChydWxlLnNlYXJjaF9saW1pdCkgewogICAgICAgICAgICAgICAgbGV0IHN0YXJ0ID0gKHBhZ2UgLSAxKSAqIHJ1bGUuc2VhcmNoX2xpbWl0OwogICAgICAgICAgICAgICAgbGV0IGVuZCA9IHBhZ2UgKiBydWxlLnNlYXJjaF9saW1pdDsKICAgICAgICAgICAgICAgIGxldCB0MSA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpOwogICAgICAgICAgICAgICAgbGV0IHNlYXJjaE1vZGUgPSB0eXBlb2YgKGJhdGNoRmV0Y2gpID09PSAnZnVuY3Rpb24nID8gJ+aJuemHjycgOiAn5Y2V5LiqJzsKICAgICAgICAgICAgICAgIGxvZygnc3RhcnQ6JyArIHN0YXJ0KTsKICAgICAgICAgICAgICAgIGxvZygnZW5kOicgKyBlbmQpOwogICAgICAgICAgICAgICAgbG9nKCfmkJzntKLmqKHlvI86JyArIHNlYXJjaE1vZGUpOwogICAgICAgICAgICAgICAgbG9nKCfnsr7lh4bmkJzntKI6JyArIHJ1bGUuc2VhcmNoX21hdGNoKTsKICAgICAgICAgICAgICAgIC8vIGxvZygndDE6JyArIHQxKTsKICAgICAgICAgICAgICAgIGlmIChzdGFydCA8IGNhblNlYXJjaC5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBsZXQgc2VhcmNoX2NsYXNzZXMgPSBjYW5TZWFyY2guc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgICAgICAgICAgICAgbGV0IHVybHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICBzZWFyY2hfY2xhc3Nlcy5mb3JFYWNoKGl0ID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IF91cmwgPSB1cmxqb2luKGl0LnR5cGVfaWQsIGlucHV0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0LmFwaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3VybCA9IF91cmwucmVwbGFjZSgnL2FwaS5waHAvcHJvdmlkZS92b2QvJywgaXQuYXBpKQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF91cmwgPSBfdXJsLnJlcGxhY2UoIiNUcnVlUGFnZSMiLCAiIiArIHRydWVQYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdXJscy5wdXNoKF91cmwpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGxldCByZXN1bHRzX2xpc3QgPSBbXTsKICAgICAgICAgICAgICAgICAgICBsZXQgcmVzdWx0cyA9IFtdOwogICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgKGJhdGNoRmV0Y2gpID09PSAnZnVuY3Rpb24nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZXFVcmxzID0gdXJscy5tYXAoaXQgPT4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGl0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHt0aW1lb3V0OiBydWxlLnRpbWVvdXR9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmV0cyA9IGJhdGNoRmV0Y2gocmVxVXJscyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkZXRhaWxVcmxzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkZXRhaWxVcmxDb3VudCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHMuZm9yRWFjaCgocmV0LCBpZHgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpdCA9IHNlYXJjaF9jbGFzc2VzW2lkeF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKHJldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0ganNvbi5saXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmZvckVhY2goaSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnNpdGVfbmFtZSA9IGl0LnR5cGVfbmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkudm9kX2lkID0gaXQudHlwZV9pZCArICckJyArIGkudm9kX2lkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS52b2RfcmVtYXJrcyA9IGkudm9kX3JlbWFya3MgKyAnfCcgKyBpdC50eXBlX25hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocnVsZS5zZWFyY2hfbWF0Y2gpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhLmZpbHRlcihpdGVtID0+IGl0ZW0udm9kX25hbWUgJiYgKG5ldyBSZWdFeHAoS0VZLCAnaScpKS50ZXN0KGl0ZW0udm9kX25hbWUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChydWxlLnNlYXJjaF9waWMgJiYgIWRhdGFbMF0udm9kX3BpYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhg5b2T5YmN5pCc57Si56uZ54K544CQJHtpdC50eXBlX25hbWV944CR5rKh5Zu+54mHLOWwneivleiuv+mXruS6jOe6p+WOu+iOt+WPluWbvueJh2ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkZXRhaWxVcmwgPSB1cmxzW2lkeF0uc3BsaXQoJ3dkPScpWzBdICsgJ2FjPWRldGFpbCZpZHM9JyArIGRhdGEubWFwKGsgPT4gay52b2RfaWQuc3BsaXQoJyQnKVsxXSkuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldGFpbFVybHMucHVzaChkZXRhaWxVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHNfbGlzdC5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogZGF0YSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzX3BpYzogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldGFpbFVybENvdW50OiBkZXRhaWxVcmxDb3VudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldGFpbFVybENvdW50Kys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgbGV0IGRldGFpbEpzb24gPSBKU09OLnBhcnNlKHJlcXVlc3QoZGV0YWlsVXJsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgIGRhdGEuZm9yRWFjaCgoZCwgX3NlcSkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgbG9nKCfkuoznuqfmlbDmja7liJfooajlhYPntKDmlbA6JyArIGRldGFpbEpzb24ubGlzdC5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgbGV0IGRldGFpbFZvZFBpYyA9IGRldGFpbEpzb24ubGlzdFtfc2VxXS52b2RfcGljOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgaWYgKGRldGFpbFZvZFBpYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24oZCwge3ZvZF9waWM6IGRldGFpbFZvZFBpY30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgIGxvZyhg5by65Yi26I635Y+W572R56uZJHtpdC50eXBlX2lkfeeahOaQnOe0ouWbvueJh+Wksei0pToke2UubWVzc2FnZX1gKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHNfbGlzdC5wdXNoKHtkYXRhOiBkYXRhLCBoYXNfcGljOiB0cnVlfSk7CgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVzdWx0cyA9IHJlc3VsdHMuY29uY2F0KGRhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coYOivt+axgjoke2l0LnR5cGVfaWR95Y+R55Sf6ZSZ6K+vOiR7ZS5tZXNzYWdlfWApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgLy8g5p6E6YCg6K+35rGC5LqM57qn55qEYmF0Y2hGZXRjaOWIl+ihqAogICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVxVXJsczIgPSBkZXRhaWxVcmxzLm1hcChpdCA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczoge3RpbWVvdXQ6IHJ1bGUudGltZW91dH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZXRzMiA9IGJhdGNoRmV0Y2gocmVxVXJsczIpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IHJlc3VsdHNfbGlzdC5sZW5ndGg7IGsrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlc3VsdF9kYXRhID0gcmVzdWx0c19saXN0W2tdLmRhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdHNfbGlzdFtrXS5oYXNfcGljKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRldGFpbEpzb24gPSBKU09OLnBhcnNlKHJldHMyW3Jlc3VsdHNfbGlzdFtrXS5kZXRhaWxVcmxDb3VudF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coJ+S6jOe6p+aVsOaNruWIl+ihqOWFg+e0oOaVsDonICsgZGV0YWlsSnNvbi5saXN0Lmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdF9kYXRhLmZvckVhY2goKGQsIF9zZXEpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGxldCBkZXRhaWxWb2RQaWMgPSBkZXRhaWxKc29uLmxpc3RbX3NlcV0udm9kX3BpYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGxvZyhkZXRhaWxKc29uKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkZXRhaWxWb2RQaWMgPSBkZXRhaWxKc29uLmxpc3QuZmluZCh2b2QgPT4gdm9kLnZvZF9pZC50b1N0cmluZygpID09PSBkLnZvZF9pZC5zcGxpdCgnJCcpWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZXRhaWxWb2RQaWMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKGQsIHt2b2RfcGljOiBkZXRhaWxWb2RQaWMudm9kX3BpY30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhg5by65Yi26I635Y+W572R56uZJHtyZXN1bHRfZGF0YVswXS5zaXRlX25hbWV955qE5pCc57Si5Zu+54mH5aSx6LSlOiR7ZS5tZXNzYWdlfWApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHMgPSByZXN1bHRzLmNvbmNhdChyZXN1bHRfZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgdXJscy5mb3JFYWNoKChfdXJsLCBpZHgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpdCA9IHNlYXJjaF9jbGFzc2VzW2lkeF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChfdXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoaHRtbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBqc29uLmxpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5mb3JFYWNoKGkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnZvZF9pZCA9IGl0LnR5cGVfaWQgKyAnJCcgKyBpLnZvZF9pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS52b2RfcmVtYXJrcyA9IGkudm9kX3JlbWFya3MgKyAnfCcgKyBpdC50eXBlX25hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJ1bGUuc2VhcmNoX21hdGNoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhLmZpbHRlcihpdGVtID0+IGl0ZW0udm9kX25hbWUgJiYgKG5ldyBSZWdFeHAoS0VZLCAnaScpKS50ZXN0KGl0ZW0udm9kX25hbWUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChydWxlLnNlYXJjaF9waWMgJiYgIWRhdGFbMF0udm9kX3BpYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nKGDlvZPliY3mkJzntKLnq5nngrnjgJAke2l0LnR5cGVfbmFtZX3jgJHmsqHlm77niYcs5bCd6K+V6K6/6Zeu5LqM57qn5Y676I635Y+W5Zu+54mHYCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGV0YWlsVXJsID0gdXJsc1tpZHhdLnNwbGl0KCd3ZD0nKVswXSArICdhYz1kZXRhaWwmaWRzPScgKyBkYXRhLm1hcChrID0+IGsudm9kX2lkLnNwbGl0KCckJylbMV0pLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRldGFpbEpzb24gPSBKU09OLnBhcnNlKHJlcXVlc3QoZGV0YWlsVXJsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nKCfkuoznuqfmlbDmja7liJfooajlhYPntKDmlbA6JyArIGRldGFpbEpzb24ubGlzdC5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuZm9yRWFjaCgoZCwgX3NlcSkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBsZXQgZGV0YWlsVm9kUGljID0gZGV0YWlsSnNvbi5saXN0W19zZXFdLnZvZF9waWM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkZXRhaWxWb2RQaWMgPSBkZXRhaWxKc29uLmxpc3QuZmluZCh2b2QgPT4gdm9kLnZvZF9pZC50b1N0cmluZygpID09PSBkLnZvZF9pZC5zcGxpdCgnJCcpWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRldGFpbFZvZFBpYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihkLCB7dm9kX3BpYzogZGV0YWlsVm9kUGljLnZvZF9waWN9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhg5by65Yi26I635Y+W572R56uZJHtpdC50eXBlX2lkfeeahOaQnOe0ouWbvueJh+Wksei0pToke2UubWVzc2FnZX1gKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRzID0gcmVzdWx0cy5jb25jYXQoZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHMgPSByZXN1bHRzLmNvbmNhdChkYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coYOivt+axgjoke2l0LnR5cGVfaWR95Y+R55Sf6ZSZ6K+vOiR7ZS5tZXNzYWdlfWApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICAgICAgVk9EUyA9IHJlc3VsdHM7CiAgICAgICAgICAgICAgICAgICAgbGV0IHQyID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgLy8gbG9nKCd0MjonK3QyKTsKICAgICAgICAgICAgICAgICAgICBsb2coYCR7c2VhcmNoTW9kZX3mkJzntKI6JHt1cmxzLmxlbmd0aH3kuKrnq5nogJfml7Y6JHsoTnVtYmVyKHQyKSAtIE51bWJlcih0MSkpfW1zYCkKCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9KSwKICAgIGxhenk6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgLy8gbGF6eeaDs+WKnuazleeUqOWvueW6lOeahHBhcnNlX3VybO+8jOS9huaYr+aciemavuW6pu+8jOaaguacquWunueOsAogICAgICAgIGxldCBwYXJzZV91cmwgPSAnJzsKICAgICAgICBpZiAoZmxhZyAmJiBmbGFnLmluY2x1ZGVzKCd8JykpIHsKICAgICAgICAgICAgbGV0IHR5cGVfbmFtZSA9IGZsYWcuc3BsaXQoJ3wnKVswXTsKICAgICAgICAgICAgbGV0IGN1cnJlbnRfdm9kID0gcnVsZS5jbGFzc2VzLmZpbmQoaXRlbSA9PiBpdGVtLnR5cGVfbmFtZSA9PT0gdHlwZV9uYW1lKTsKICAgICAgICAgICAgaWYgKGN1cnJlbnRfdm9kICYmIGN1cnJlbnRfdm9kLnBhcnNlX3VybCkgewogICAgICAgICAgICAgICAgcGFyc2VfdXJsID0gY3VycmVudF92b2QucGFyc2VfdXJsCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKC9cLihtM3U4fG1wNCkvLnRlc3QoaW5wdXQpKSB7CiAgICAgICAgICAgIGlucHV0ID0ge3BhcnNlOiAwLCB1cmw6IGlucHV0fQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmIChwYXJzZV91cmwuc3RhcnRzV2l0aCgnanNvbjonKSkgewogICAgICAgICAgICAgICAgbGV0IHB1cmwgPSBwYXJzZV91cmwucmVwbGFjZSgnanNvbjonLCAnJykgKyBpbnB1dDsKICAgICAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChwdXJsKTsKICAgICAgICAgICAgICAgIGlucHV0ID0ge3BhcnNlOiAwLCB1cmw6IEpTT04ucGFyc2UoaHRtbCkudXJsfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgaW5wdXQgPSBwYXJzZV91cmwgKyBpbnB1dDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0pLAp9
|
||||
@@ -0,0 +1,90 @@
|
||||
var rule = {
|
||||
title: '金牌影院',
|
||||
host: 'https://m.cfkj86.com',
|
||||
url: '/api/mw-movie/anonymous/video/list?pageNum=fypage&pageSize=30&sort=1&sortBy=1&type1=fyclass',
|
||||
searchUrl: '/api/mw-movie/anonymous/video/searchByWordPageable?keyword=**&pageNum=fypage&pageSize=12&type=false',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
||||
'Referer': 'https://www.cfkj86.com/'
|
||||
},
|
||||
searchable: 2,
|
||||
quickSearch: 0,
|
||||
filterable: 0,
|
||||
class_name: '电影&电视剧&综艺&动漫',
|
||||
class_url: '1&2&3&4',
|
||||
limit: 6,
|
||||
double: false,
|
||||
play_parse:true,
|
||||
lazy:$js.toString(()=>{
|
||||
let pid = input.split('/')[5]
|
||||
let nid = input.split('/')[7]
|
||||
const t = new Date().getTime()
|
||||
eval(getCryptoJS)
|
||||
let signkey = 'id='+pid+'&nid='+nid+'&key=cb808529bae6b6be45ecfab29a4889bc&t='+t
|
||||
const key = CryptoJS.SHA1(CryptoJS.MD5(signkey).toString()).toString()
|
||||
let json_data = JSON.parse(request('https://www.cfkj86.com/api/mw-movie/anonymous/v1/video/episode/url?id='+pid+'&nid='+nid,{headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
||||
'deviceid': 'c6bce57d-bb62-4db7-96cd-265dfb2a79cf',
|
||||
'sign': key,
|
||||
't': t
|
||||
}}))
|
||||
log(json_data)
|
||||
let link = json_data.data.playUrl
|
||||
input={url:link,header:rule.headers}
|
||||
|
||||
}),
|
||||
一级: $js.toString(()=>{
|
||||
let d = []
|
||||
let url = ''
|
||||
const t = new Date().getTime()
|
||||
const signkey = 'pageNum='+MY_PAGE+'&pageSize=30&sort=1&sortBy=1&type1='+MY_CATE+'&key=cb808529bae6b6be45ecfab29a4889bc&t='+t
|
||||
const key = CryptoJS.SHA1(CryptoJS.MD5(signkey).toString()).toString()
|
||||
const list = JSON.parse(request(input,{headers:{
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'deviceId': 'c6bce57d-bb62-4db7-96cd-265dfb2a79cf',
|
||||
'sign': key,
|
||||
't': t
|
||||
}})).data.list
|
||||
list.forEach((it)=>{
|
||||
url = 'https://www.cfkj86.com/detail/'+it.vodId
|
||||
d.push({
|
||||
title: it.vodName,
|
||||
desc:it.vodRemarks,
|
||||
img:it.vodPic,
|
||||
url:url
|
||||
})
|
||||
})
|
||||
setResult(d)
|
||||
}),
|
||||
二级: {
|
||||
title: 'h1&&Text',
|
||||
tabs: '.top a',
|
||||
lists: '.main-list-sections__BodyArea-sc-8bb7334b-2 .listitem a',
|
||||
},
|
||||
搜索: $js.toString(()=>{
|
||||
const t = new Date().getTime()
|
||||
eval(getCryptoJS)
|
||||
let pg = MY_PAGE
|
||||
let signkey = 'keyword='+KEY+'&pageNum='+pg+'&pageSize=12&type=false&key=cb808529bae6b6be45ecfab29a4889bc&t='+t
|
||||
const key = CryptoJS.SHA1(CryptoJS.MD5(signkey).toString()).toString()
|
||||
let html = JSON.parse(request(input,{headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
||||
'deviceid': '58a80c52-138c-48fd-8edb-138fd74d12c8',
|
||||
'sign': key,
|
||||
't': t
|
||||
}}))
|
||||
let data = html.data.list
|
||||
let d = []
|
||||
data.forEach(it=>{
|
||||
let reurl = 'https://www.cfkj86.com/detail/'+it.vodId
|
||||
d.push({
|
||||
title: it.vodName,
|
||||
desc:it.vodVersion,
|
||||
img:it.vodPic,
|
||||
url:reurl
|
||||
})
|
||||
})
|
||||
setResult(d)
|
||||
}),
|
||||
}
|
||||
Reference in New Issue
Block a user