mirror of
https://git.oceanpay.cc/danial/kami_jd_ck.git
synced 2025-12-18 22:11:07 +00:00
fix: update drone config
This commit is contained in:
61
.drone.yml
Normal file
61
.drone.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: ticket_slide_server
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: git.kkknametrans.buzz/danial/kami_jd_ticket_slide_server_${DRONE_BRANCH}
|
||||
dockerfile: kami_jd_ticket_slide_server/Dockerfile
|
||||
context: kami_jd_ticket_slide_server
|
||||
tags: latest
|
||||
registry: git.kkknametrans.buzz
|
||||
auth:
|
||||
from_secret: 6acddd2c6f1c0df7f0f3bb848caeeced6ec6ef2a
|
||||
when:
|
||||
changes:
|
||||
- kami_jd_ticket_slide_server/**
|
||||
|
||||
- name: unidbg_boot_server
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: git.kkknametrans.buzz/danial/kami_jd_unidbg_boot_server_jar_${DRONE_BRANCH}
|
||||
dockerfile: kami_jd_unidbg_boot_server_jar/Dockerfile
|
||||
context: kami_jd_unidbg_boot_server_jar
|
||||
tags: latest
|
||||
registry: git.kkknametrans.buzz
|
||||
auth:
|
||||
from_secret: 6acddd2c6f1c0df7f0f3bb848caeeced6ec6ef2a
|
||||
when:
|
||||
changes:
|
||||
- kami_jd_unidbg_boot_server_jar/**
|
||||
|
||||
- name: bind_card
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: git.kkknametrans.buzz/danial/jd_bind_card_${DRONE_BRANCH}
|
||||
dockerfile: jd_bind_card/Dockerfile
|
||||
context: jd_bind_card
|
||||
tags: latest
|
||||
registry: git.kkknametrans.buzz
|
||||
auth:
|
||||
from_secret: 6acddd2c6f1c0df7f0f3bb848caeeced6ec6ef2a
|
||||
when:
|
||||
changes:
|
||||
- jd_bind_card/**
|
||||
|
||||
- name: babel_channel
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: git.kkknametrans.buzz/danial/jd_babel_channel_${DRONE_BRANCH}
|
||||
dockerfile: jd_babel_channel/Dockerfile
|
||||
context: jd_babel_channel
|
||||
tags: latest
|
||||
registry: git.kkknametrans.buzz
|
||||
auth:
|
||||
from_secret: 6acddd2c6f1c0df7f0f3bb848caeeced6ec6ef2a
|
||||
when:
|
||||
changes:
|
||||
- jd_babel_channel/**
|
||||
|
||||
46
docker-compose.yml
Normal file
46
docker-compose.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
ticket_slide_server:
|
||||
build:
|
||||
context: ./kami_jd_ticket_slide_server
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "5000:5000"
|
||||
restart: always
|
||||
networks:
|
||||
- kami_network
|
||||
|
||||
unidbg_boot_server:
|
||||
build:
|
||||
context: ./kami_jd_unidbg_boot_server_jar
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
restart: always
|
||||
networks:
|
||||
- kami_network
|
||||
|
||||
bind_card:
|
||||
build:
|
||||
context: ./jd_bind_card
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "5001:5001"
|
||||
restart: always
|
||||
networks:
|
||||
- kami_network
|
||||
|
||||
babel_channel:
|
||||
build:
|
||||
context: ./jd_babel_channel
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "5002:5002"
|
||||
restart: always
|
||||
networks:
|
||||
- kami_network
|
||||
|
||||
networks:
|
||||
kami_network:
|
||||
driver: bridge
|
||||
8
jd_babel_channel/.idea/.gitignore
generated
vendored
Normal file
8
jd_babel_channel/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
14
jd_babel_channel/.idea/deployment.xml
generated
Normal file
14
jd_babel_channel/.idea/deployment.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData">
|
||||
<serverData>
|
||||
<paths name="root@120.24.83.163:22 password">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
</component>
|
||||
</project>
|
||||
25
jd_babel_channel/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
25
jd_babel_channel/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="11">
|
||||
<item index="0" class="java.lang.String" itemvalue="django-filters" />
|
||||
<item index="1" class="java.lang.String" itemvalue="opencv-python" />
|
||||
<item index="2" class="java.lang.String" itemvalue="pillow" />
|
||||
<item index="3" class="java.lang.String" itemvalue="flask_cors" />
|
||||
<item index="4" class="java.lang.String" itemvalue="pyexecjs" />
|
||||
<item index="5" class="java.lang.String" itemvalue="requests" />
|
||||
<item index="6" class="java.lang.String" itemvalue="uwsgi" />
|
||||
<item index="7" class="java.lang.String" itemvalue="flask" />
|
||||
<item index="8" class="java.lang.String" itemvalue="selenium" />
|
||||
<item index="9" class="java.lang.String" itemvalue="urllib3" />
|
||||
<item index="10" class="java.lang.String" itemvalue="redis" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
6
jd_babel_channel/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
jd_babel_channel/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
19
jd_babel_channel/.idea/jd_babel_channel.iml
generated
Normal file
19
jd_babel_channel/.idea/jd_babel_channel.iml
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="Flask">
|
||||
<option name="enabled" value="true" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/../jd_babel_channel\templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
||||
7
jd_babel_channel/.idea/misc.xml
generated
Normal file
7
jd_babel_channel/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (jd_babel_channel)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
jd_babel_channel/.idea/modules.xml
generated
Normal file
8
jd_babel_channel/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/jd_babel_channel.iml" filepath="$PROJECT_DIR$/.idea/jd_babel_channel.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
51
jd_babel_channel/Dockerfile
Normal file
51
jd_babel_channel/Dockerfile
Normal file
@@ -0,0 +1,51 @@
|
||||
# 基于 Python 3.9-slim 镜像
|
||||
FROM python:3.9-slim
|
||||
|
||||
# 修改apt-get源地址为阿里云镜像
|
||||
RUN echo "" > /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian buster main" >> /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >> /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian buster-updates main" >> /etc/apt/sources.list
|
||||
|
||||
# 安装必要的工具和依赖
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
gnupg \
|
||||
libgl1-mesa-glx \
|
||||
libglib2.0-0 \
|
||||
build-essential \
|
||||
python3-dev \
|
||||
libev-dev \
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 升级pip
|
||||
RUN pip install --upgrade pip
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 先复制依赖文件
|
||||
COPY requirements.txt .
|
||||
|
||||
# 安装Python依赖
|
||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gunicorn[gevent] gevent
|
||||
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
|
||||
RUN pip install --no-cache-dir ddddocr -i https://pypi.tuna.tsinghua.edu.cn/simple/
|
||||
|
||||
# 创建日志目录
|
||||
RUN mkdir -p /app/logs && chmod 777 /app/logs
|
||||
|
||||
# 复制应用代码
|
||||
COPY . .
|
||||
|
||||
# 暴露容器端口
|
||||
EXPOSE 5002
|
||||
|
||||
ENV FLASK_APP=app.py
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# 运行应用
|
||||
CMD ["gunicorn", "-c", "gunicorn.conf.py", "app:app"]
|
||||
BIN
jd_babel_channel/__pycache__/app.cpython-38.pyc
Normal file
BIN
jd_babel_channel/__pycache__/app.cpython-38.pyc
Normal file
Binary file not shown.
BIN
jd_babel_channel/__pycache__/logger.cpython-38.pyc
Normal file
BIN
jd_babel_channel/__pycache__/logger.cpython-38.pyc
Normal file
Binary file not shown.
BIN
jd_babel_channel/__pycache__/spider.cpython-38.pyc
Normal file
BIN
jd_babel_channel/__pycache__/spider.cpython-38.pyc
Normal file
Binary file not shown.
549
jd_babel_channel/app.py
Normal file
549
jd_babel_channel/app.py
Normal file
@@ -0,0 +1,549 @@
|
||||
import ctypes
|
||||
import hashlib
|
||||
import json
|
||||
import time
|
||||
import traceback
|
||||
from urllib.parse import parse_qs
|
||||
import logging
|
||||
import logging.config
|
||||
import os
|
||||
|
||||
import requests
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS
|
||||
|
||||
from logger import get_logger
|
||||
from spider import AppStoreSpider, GoodsAppleCard, GameArea, DeleteOrder, LoginSpider
|
||||
|
||||
app = Flask(__name__)
|
||||
# 跨域
|
||||
CORS(app)
|
||||
# 配置日志
|
||||
logging.config.fileConfig('logging.conf')
|
||||
logger = logging.getLogger('app')
|
||||
|
||||
|
||||
# 苹果权益充值
|
||||
@app.route('/jd/app/store', methods=['GET', 'POST'], strict_slashes=False)
|
||||
def app_store():
|
||||
if request.method == 'GET':
|
||||
return 'app_store'
|
||||
elif request.method == 'POST':
|
||||
# 接收参数
|
||||
data = json.loads(request.get_data())
|
||||
face_price = data.get("face_price")
|
||||
order_num = data.get("order_num")
|
||||
cookies = data.get("cookies")
|
||||
# 打印参数日志
|
||||
logger.info(f"订单ID:{order_num},cookies:{cookies}")
|
||||
logger.info(f"订单ID:{order_num},card_pwd:{face_price}")
|
||||
app_store = AppStoreSpider(
|
||||
cookies=cookies,
|
||||
face_price=face_price,
|
||||
order_num=order_num
|
||||
)
|
||||
code, res = app_store.run()
|
||||
item = {
|
||||
"code": code,
|
||||
"data": res
|
||||
}
|
||||
logger.info(f"订单ID:{order_num},最终返回日志:{item}")
|
||||
# 打印响应日志
|
||||
return jsonify(item)
|
||||
|
||||
|
||||
# 查卡密
|
||||
@app.route('/jd/query/card', methods=['GET', 'POST'], strict_slashes=False)
|
||||
def query_card():
|
||||
if request.method == 'GET':
|
||||
return 'query_card'
|
||||
elif request.method == 'POST':
|
||||
# 接收参数
|
||||
data = json.loads(request.get_data())
|
||||
jd_order_num = data.get("jd_order_num")
|
||||
cookies = data.get("cookies")
|
||||
# 打印参数日志
|
||||
logger.info(f"订单ID:{jd_order_num},cookies:{cookies}")
|
||||
app_store = AppStoreSpider(
|
||||
cookies=cookies,
|
||||
order_num=jd_order_num
|
||||
)
|
||||
code, res = app_store.get_card_secret(jd_order_num)
|
||||
item = {
|
||||
"code": code,
|
||||
"data": res
|
||||
}
|
||||
logger.info(f"订单ID:{jd_order_num},最终返回日志:{item}")
|
||||
# 打印响应日志
|
||||
return jsonify(item)
|
||||
|
||||
|
||||
# 获取sku参数
|
||||
@app.route('/jd/sku', methods=['GET', 'POST'], strict_slashes=False)
|
||||
def game_area():
|
||||
if request.method == 'GET':
|
||||
return 'game_area'
|
||||
elif request.method == 'POST':
|
||||
data = json.loads(request.get_data())
|
||||
cookies = data.get("cookies")
|
||||
sku_id = data.get("sku_id")
|
||||
details = GameArea.get_details(cookies, sku_id)
|
||||
data = details.get("result", {})
|
||||
item = {
|
||||
"code": 100 if data else 110,
|
||||
"data": data
|
||||
}
|
||||
return jsonify(item)
|
||||
|
||||
|
||||
# 账号类下单
|
||||
@app.route('/jd/goods/store', methods=['GET', 'POST'], strict_slashes=False)
|
||||
def goods_store():
|
||||
if request.method == 'GET':
|
||||
return 'goods_store'
|
||||
elif request.method == 'POST':
|
||||
data = json.loads(request.get_data())
|
||||
# 参数
|
||||
face_price = data.get("face_price")
|
||||
order_num = data.get("order_num")
|
||||
cookies = data.get("cookies")
|
||||
brand_id = data.get("brand_id")
|
||||
sku_id = data.get("sku_id")
|
||||
username = data.get("username")
|
||||
game_srv = data.get("gamesrv")
|
||||
game_area = data.get("gamearea")
|
||||
# 类型 1:username账号充值,2:游戏区服充值
|
||||
recharge_type = data.get("recharge_type")
|
||||
# 打印参数日志
|
||||
logger.info(f"订单ID:{order_num},cookies:{cookies}")
|
||||
logger.info(f"订单ID:{order_num},card_pwd:{face_price}")
|
||||
app_store = GoodsAppleCard(
|
||||
cookies=cookies,
|
||||
face_price=face_price,
|
||||
order_num=order_num,
|
||||
sku_id=sku_id,
|
||||
brand_id=brand_id,
|
||||
username=username,
|
||||
game_srv=game_srv,
|
||||
game_area=game_area,
|
||||
recharge_type=recharge_type,
|
||||
)
|
||||
code, res = app_store.run()
|
||||
item = {
|
||||
"code": code,
|
||||
"data": res
|
||||
}
|
||||
logger.info(f"订单ID:{order_num},goods_store最终返回日志:{item}")
|
||||
# 打印响应日志
|
||||
return jsonify(item)
|
||||
|
||||
|
||||
def r(data_string):
|
||||
def int_overflow(val):
|
||||
maxint = 2147483647
|
||||
if not -maxint - 1 <= val <= maxint:
|
||||
val = (val + (maxint + 1)) % (2 * (maxint + 1)) - maxint - 1
|
||||
return val
|
||||
|
||||
def unsigned_right_shitf(n, i):
|
||||
# 数字小于0,则转为32位无符号uint
|
||||
if n < 0:
|
||||
n = ctypes.c_uint32(n).value
|
||||
# 正常位移位数是为正数,但是为了兼容js之类的,负数就右移变成左移好了
|
||||
if i < 0:
|
||||
return -int_overflow(n << abs(i))
|
||||
# print(n)
|
||||
return int_overflow(n >> i)
|
||||
|
||||
char_list = []
|
||||
aae = ['K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'U', 'V',
|
||||
'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l', 'm', 'n', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/']
|
||||
bArr = data_string.encode('utf-8')
|
||||
for i in range(0, len(bArr), 3):
|
||||
bArr2 = [None for i in range(4)]
|
||||
b2 = 0
|
||||
for i2 in range(0, 3):
|
||||
i3 = i + i2
|
||||
if i3 <= len(bArr) - 1:
|
||||
bArr2[i2] = b2 | unsigned_right_shitf((bArr[i3] & 255), ((i2 * 2) + 2))
|
||||
b2 = unsigned_right_shitf(((bArr[i3] & 255) << (((2 - i2) * 2) + 2)) & 255, 2)
|
||||
else:
|
||||
bArr2[i2] = b2
|
||||
b2 = 64
|
||||
bArr2[3] = b2
|
||||
for i4 in range(4):
|
||||
if bArr2[i4] <= 63:
|
||||
char_list.append(aae[bArr2[i4]])
|
||||
else:
|
||||
char_list.append("=")
|
||||
|
||||
return "".join(char_list)
|
||||
|
||||
|
||||
def encode_cipher(cipher_dict):
|
||||
for k, v in cipher_dict.items():
|
||||
cipher_dict[k] = r(v)
|
||||
|
||||
|
||||
def gen_cipher_ep(uuid, ts):
|
||||
"""
|
||||
|
||||
:param uid:
|
||||
:param aid:
|
||||
:param open_udid:
|
||||
:param ts:
|
||||
:return:
|
||||
"""
|
||||
cipher_dict = {
|
||||
"d_model": "SM-N9760",
|
||||
"wifiBssid": "unknown",
|
||||
"osVersion": "9",
|
||||
"d_brand": "samsung",
|
||||
"screen": "960*540",
|
||||
"uuid": uuid,
|
||||
"aid": uuid,
|
||||
}
|
||||
encode_cipher(cipher_dict)
|
||||
data_dict = {
|
||||
"hdid": "JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw=",
|
||||
"ts": ts,
|
||||
'ridx': -1,
|
||||
'cipher': cipher_dict,
|
||||
'ciphertype': 5,
|
||||
"version": "1.2.0",
|
||||
'appname': "com.jingdong.app.mall"
|
||||
}
|
||||
ep = json.dumps(data_dict, separators=(',', ':'))
|
||||
|
||||
return ep
|
||||
|
||||
|
||||
def get_pay_sign(order_id, face_price):
|
||||
app_id = "jd_android_app4"
|
||||
pay_app_key = "e53jfgRgd7Hk"
|
||||
input_str = f"{app_id};{order_id};37;{face_price};{pay_app_key}"
|
||||
# 获取 MD5 实例
|
||||
input_bytes = input_str.encode("GBK")
|
||||
md5_hash = hashlib.md5()
|
||||
md5_hash.update(input_bytes)
|
||||
return md5_hash.hexdigest()
|
||||
|
||||
|
||||
def get_sign(func, body, uuid, version):
|
||||
headers_jd = {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
payload = json.dumps({
|
||||
"func": func,
|
||||
"body": body,
|
||||
"uid": uuid,
|
||||
"platform": "android",
|
||||
"version": version
|
||||
})
|
||||
unidbg_url = "http://127.0.0.1:9999/api/jd/encrypt"
|
||||
response_jd = requests.request("POST", url=unidbg_url, headers=headers_jd, data=payload)
|
||||
res = response_jd.json()
|
||||
params = parse_qs(res["data"])
|
||||
formatted_params = {key: value[0] for key, value in params.items()}
|
||||
return formatted_params
|
||||
|
||||
|
||||
def my_json(code, data, msg):
|
||||
return {
|
||||
"code": code,
|
||||
"data": data,
|
||||
"msg": msg
|
||||
}
|
||||
|
||||
|
||||
@app.route('/api/v1/jd/wx/plat_pay_channel', methods=["GET", "POST"], strict_slashes=False)
|
||||
def plat_pay_channel():
|
||||
if request.method == "GET":
|
||||
return "okk"
|
||||
elif request.method == "POST":
|
||||
import uuid
|
||||
# 接收参数
|
||||
data = json.loads(request.get_data())
|
||||
app.logger.info(f"接收到的请求数据: {data}")
|
||||
# 获取数据
|
||||
order_id = data.get("order_id")
|
||||
face_price = data.get("face_price")
|
||||
face_price = str("{:.2f}".format(float(face_price)))
|
||||
pay_id = data.get("pay_id")
|
||||
cookies = data.get("cookies")
|
||||
|
||||
# 打印日志
|
||||
app.logger.info(f"获取微信app端支付参数")
|
||||
app.logger.info(f"cookie:{cookies}")
|
||||
app.logger.info(f"order_id:{order_id}")
|
||||
app.logger.info(f"face_price:{face_price}")
|
||||
app.logger.info(f"pay_id:{pay_id}")
|
||||
|
||||
headers = {
|
||||
"Host": "api.m.jd.com",
|
||||
"charset": "UTF-8",
|
||||
"user-agent": "okhttp/3.12.1;jdmall;android;version/11.1.0;build/98139",
|
||||
"cache-control": "no-cache",
|
||||
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"cookie": cookies
|
||||
}
|
||||
url = "https://api.m.jd.com/client.action"
|
||||
func = "platPayChannel"
|
||||
version = "11.1.0"
|
||||
uuid = str(uuid.uuid4()).replace("-", "")
|
||||
ts = int(time.time() * 1000)
|
||||
ep = gen_cipher_ep(uuid, ts)
|
||||
pay_sign = get_pay_sign(order_id=order_id, face_price=face_price)
|
||||
body = '{"appId":"jd_android_app4","client":"android","fk_aid":"%s","fk_appId":"com.jingdong.app.mall","fk_latitude":"NfUaIOrNMes=","fk_longtitude":"NfUaIOrNMes=","fk_terminalType":"02","fk_traceIp":"26.26.26.1","hasCyberMoneyPay":"0","hasHuaweiPay":"0","hasOCPay":"0","hasUPPay":"0","orderId":"%s","orderPrice":"%s","orderType":"37","orderTypeCode":"0","origin":"native","payId":"%s","paySign":"%s","paySourceId":"2","payablePrice":"%s","sdkToken":"jdd016CSEHGQ3IPOGEXVOBUPDLTBSKZZUMESDDOP4PPRC2E2R7CC2K4LXQN63E6A3P3Y76GN4M5TMPIZGOWYQJG4MO6ET75VQFVQL2MIYRFQ01234567","source":"jdapp","style":"normal","supportNFC":"1"}' % (
|
||||
uuid, order_id, face_price, pay_id, pay_sign, face_price
|
||||
)
|
||||
formatted_params = get_sign(func, body, uuid, version)
|
||||
params = {
|
||||
"functionId": func,
|
||||
"clientVersion": version,
|
||||
"build": "98139",
|
||||
"client": "android",
|
||||
"partner": "wandoujia",
|
||||
# "eid": "eidAf760812200s2xOZPVA0sThGrvhABq1zrPMTmUOM1tv8FFg1FjE8yRJtYdV/UFhJuIkVZbrk/xl XPeoFQTNgMiYJpXeeyACCVPbt0/3R7R3Gd 8y",
|
||||
"sdkVersion": "28",
|
||||
"lang": "zh_CN",
|
||||
"harmonyOs": "0",
|
||||
"networkType": "wifi",
|
||||
# "uts": "0f31TVRjBSsqndu4/jgUPz6uymy50MQJ8fZr7wet7pLPYx9jEXMpd8VCD64sq/eBbsH5zZBXnKZMkN1vxnjOrpfx7GiQBINsuAELLpjOiZsCHkTDoRW/d9talOxyn2bo1YZLq8uq5Kdx/Fd7diA023Qwr+5V5TzeOnca3cc6QzMFh8p+DS2gR6Bimgz0BiNqbeN1q1NA9rJ/t5QOAIH9EA==",
|
||||
"uemps": "0-0",
|
||||
"ext": "{\"prstate\":\"0\",\"pvcStu\":\"1\"}",
|
||||
"ef": "1",
|
||||
"ep": ep,
|
||||
"st": formatted_params["st"],
|
||||
"sign": formatted_params["sign"],
|
||||
"sv": formatted_params["sv"]
|
||||
}
|
||||
data = {
|
||||
"body": body,
|
||||
"": ""
|
||||
}
|
||||
client_res = None
|
||||
# try:
|
||||
response = requests.post(
|
||||
url=url,
|
||||
params=params,
|
||||
headers=headers,
|
||||
data=data
|
||||
)
|
||||
client_res = response.json()
|
||||
app.logger.info(f"订单id:{order_id},获取支付参数res返回:{client_res}")
|
||||
# except Exception as e:
|
||||
# app.logger.info(traceback.format_exc())
|
||||
# 不支持该支付类型
|
||||
if client_res.get("errorCode") == "-2":
|
||||
return my_json(code=20014, data={}, msg="订单类型不支持")
|
||||
# ck失效
|
||||
if client_res.get("errorCode") == "3":
|
||||
return my_json(code=20002, data={}, msg="ck失效")
|
||||
# 订单失效
|
||||
if client_res.get("errorCode") == "-3":
|
||||
return my_json(code=20005, data={}, msg="订单失效")
|
||||
# 订单与下单账号不同
|
||||
if client_res.get("errorCode") == "-5":
|
||||
return my_json(code=20015, data={}, msg="订单与下单账号不匹配")
|
||||
# 订单已取消
|
||||
if client_res.get("errorCode") == "-100":
|
||||
return my_json(code=20006, data={}, msg="订单已支付完成或已取消")
|
||||
# 订单已支付完成或已取消
|
||||
if client_res.get("mcashierConfirmInfo", {}).get("errorCode", "") == "-100":
|
||||
return my_json(code=20006, data={}, msg="订单已支付完成或已取消")
|
||||
# 获取微信支付参数
|
||||
url = "https://api.m.jd.com/client.action"
|
||||
headers = {
|
||||
"Host": "api.m.jd.com",
|
||||
"charset": "UTF-8",
|
||||
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
|
||||
"cache-control": "no-cache",
|
||||
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"cookie": cookies
|
||||
}
|
||||
import uuid
|
||||
uuid = str(uuid.uuid4()).replace("-", "")
|
||||
ts = int(time.time() * 1000)
|
||||
ep = gen_cipher_ep(uuid, ts)
|
||||
pay_sign = get_pay_sign(order_id=order_id, face_price=face_price)
|
||||
sdk_token = "jdd01XYE6SS5ZXXG7F74OZC3PKG5LWF7W3GTVLTSUH56A2YAUXOT6NEEX4TRT3I3XDDYO7NQSIV4BSK3XGKWMROTBRKO4ENETDD4IEHFWZHA01234567"
|
||||
body = '{"appId":"jd_android_app4","backUrl":"","client":"android","orderId":"%s","orderPrice":"%s","orderType":"37","orderTypeCode":"0","origin":"native","payId":"%s","paySign":"%s","sdkToken":"%s","source":"jdapp"}' % (
|
||||
order_id, face_price, pay_id, pay_sign, sdk_token)
|
||||
func = "platWXPay"
|
||||
version = "11.0.0"
|
||||
formatted_params = get_sign(func, body, uuid, version)
|
||||
params = {
|
||||
"functionId": "platWXPay",
|
||||
"clientVersion": "11.0.0",
|
||||
# "build": "97235",
|
||||
"client": "android",
|
||||
"partner": "huawei",
|
||||
# "eid": "eidAd2c08121b3s9eOeub59TR2G1LS3GtRpmFHjnr/5tBkXKUdbZOahaF5ejedAIDQFfwVV2GDYUzftxnEQRjdhD5bpPNR4B0qK9tPJ 5liDjiHAhDR3",
|
||||
"sdkVersion": "28",
|
||||
"lang": "zh_CN",
|
||||
"harmonyOs": "0",
|
||||
"networkType": "wifi",
|
||||
# "uts": "0f31TVRjBSsqndu4/jgUPz6uymy50MQJVJk5AARu8sQVESbyLWRZZNMf5XbN+023PgE2PL4I0aLSvISDbN3u1a1oIB1KTvzrqacX+46wkkSjXxvvYKogR9YCbfnMf2pdC5H/VDcJc2u6uHTxPVwvhLoJ8vX8cN45ZijAbikou9B5o2KTvMTzCfrSYgi3+mls/cA+6k+Ao5sFIIdtimZ6bw==",
|
||||
"uemps": "0-0",
|
||||
"ext": "{\"prstate\":\"0\",\"pvcStu\":\"1\"}",
|
||||
"ef": "1",
|
||||
"ep": ep,
|
||||
"st": formatted_params["st"],
|
||||
"sign": formatted_params["sign"],
|
||||
"sv": formatted_params["sv"]
|
||||
}
|
||||
data = {
|
||||
"body": body,
|
||||
}
|
||||
pay_channel_res = None
|
||||
for i in range(3):
|
||||
try:
|
||||
response = requests.post(
|
||||
url=url,
|
||||
params=params,
|
||||
headers=headers,
|
||||
data=data,
|
||||
timeout=2
|
||||
)
|
||||
pay_channel_res = response.json()
|
||||
print(pay_channel_res)
|
||||
app.logger.info(f"订单id:{order_id},获取微信支付参数返回:{pay_channel_res}")
|
||||
break
|
||||
except Exception as e:
|
||||
app.logger.info(traceback.format_exc())
|
||||
continue
|
||||
# 当前支付方式不可用,建议选择其他支付方式
|
||||
if pay_channel_res.get("errorCode") == "-1":
|
||||
return my_json(code=60001, data={}, msg="爬虫异常")
|
||||
# 加密算法失效
|
||||
if pay_channel_res.get("code") == "600":
|
||||
return my_json(code=60001, data={}, msg="加密算法异常")
|
||||
# 不支持该支付类型
|
||||
if pay_channel_res.get("errorCode") == "-2":
|
||||
return my_json(code=20014, data={}, msg="订单类型不支持")
|
||||
# ck失效
|
||||
if pay_channel_res.get("errorCode") == "3":
|
||||
return my_json(code=20002, data={}, msg="ck失效")
|
||||
# 订单失效
|
||||
if pay_channel_res.get("errorCode") == "-3":
|
||||
return my_json(code=20005, data={}, msg="订单失效")
|
||||
# 订单与下单账号不同
|
||||
if pay_channel_res.get("errorCode") == "-5":
|
||||
return my_json(code=20015, data={}, msg="订单与下单账号不匹配")
|
||||
# 订单已取消
|
||||
if pay_channel_res.get("errorCode") == "-100":
|
||||
return my_json(code=20006, data={}, msg="订单已支付完成或已取消")
|
||||
# 订单已支付完成或已取消
|
||||
if pay_channel_res.get("mcashierConfirmInfo", {}).get("errorCode", "") == "-100":
|
||||
return my_json(code=20006, data={}, msg="订单已支付完成或已取消")
|
||||
# 获取数据
|
||||
pay_info = pay_channel_res["payInfo"]
|
||||
item = {
|
||||
"pay_order_id": pay_channel_res["payOrderId"],
|
||||
"pay_id": pay_channel_res["payId"],
|
||||
"ts": pay_info["timeStamp"],
|
||||
"package_name": pay_info["package"],
|
||||
"pay_enum": pay_info["payEnum"],
|
||||
"jd_pay_id": pay_info["jdPayId"],
|
||||
"sign": pay_info["sign"],
|
||||
"pre_pay_id": pay_info["prepayId"],
|
||||
"partner_id": pay_info["partnerId"],
|
||||
"nonce_str": pay_info["nonceStr"],
|
||||
}
|
||||
print(item)
|
||||
return my_json(
|
||||
code=2000,
|
||||
data=item,
|
||||
msg="请求成功"
|
||||
)
|
||||
|
||||
|
||||
@app.route('/api/v1/jd/delete_order', methods=["GET", "POST"], strict_slashes=False)
|
||||
def delete_order():
|
||||
if request.method == "GET":
|
||||
return "okk"
|
||||
elif request.method == "POST":
|
||||
# 接收参数
|
||||
data = json.loads(request.get_data())
|
||||
app.logger.info(f"接收到的请求数据: {data}")
|
||||
# 获取数据
|
||||
cookie = data.get("cookie")
|
||||
order_id = data.get("order_id")
|
||||
delete_res = DeleteOrder(
|
||||
cookie=cookie,
|
||||
order_id=order_id
|
||||
).run()
|
||||
if isinstance(delete_res.get("body"), bool):
|
||||
code = 2000
|
||||
else:
|
||||
code = 2001
|
||||
return my_json(
|
||||
code=code,
|
||||
data={},
|
||||
msg="请求成功"
|
||||
)
|
||||
|
||||
|
||||
@app.route('/jd/sms/code', methods=["GET", "POST"], strict_slashes=False)
|
||||
def get_code():
|
||||
if request.method == "GET":
|
||||
return "okk"
|
||||
elif request.method == "POST":
|
||||
data = json.loads(request.get_data())
|
||||
# 参数
|
||||
phone = data.get("phone")
|
||||
res = LoginSpider(
|
||||
phone=phone,
|
||||
).run_send_code()
|
||||
logger.info(f"发送验证码返回:{res}")
|
||||
# 打印响应日志
|
||||
return jsonify(res)
|
||||
|
||||
|
||||
@app.route('/jd/sms/login', methods=["GET", "POST"], strict_slashes=False)
|
||||
def sms_login():
|
||||
if request.method == "GET":
|
||||
return "okk"
|
||||
elif request.method == "POST":
|
||||
data = json.loads(request.get_data())
|
||||
# 参数
|
||||
phone = data.get("phone")
|
||||
ck = data.get("ck")
|
||||
code = data.get("code")
|
||||
s_token = data.get("s_token")
|
||||
jd_risk_token_id = data.get("jd_risk_token_id")
|
||||
rsa_modulus = data.get("rsa_modulus")
|
||||
res = LoginSpider(
|
||||
phone=phone,
|
||||
).run_get_ck(
|
||||
ck=ck,
|
||||
code=code,
|
||||
s_token=s_token,
|
||||
jd_risk_token_id=jd_risk_token_id,
|
||||
rsa_modulus=rsa_modulus
|
||||
)
|
||||
logger.info(f"短信登录返回:{res}")
|
||||
# 打印响应日志
|
||||
return jsonify(res)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
logger.info('访问首页')
|
||||
return 'Hello World'
|
||||
|
||||
|
||||
@app.route('/api/endpoint')
|
||||
def api_endpoint():
|
||||
try:
|
||||
logger.info('处理API请求')
|
||||
# ... existing code ...
|
||||
except Exception as e:
|
||||
logger.error(f'API请求处理失败: {str(e)}')
|
||||
return {'error': str(e)}, 500
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="0.0.0.0", port=8289)
|
||||
19
jd_babel_channel/gun.conf
Normal file
19
jd_babel_channel/gun.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
# 并行工作进程数
|
||||
workers = 4
|
||||
# 指定每个工作者的线程数
|
||||
threads = 8
|
||||
# 监听内网端口80
|
||||
bind = '0.0.0.0:8289'
|
||||
# 工作模式协程
|
||||
worker_class = 'gevent'
|
||||
# 设置最大并发量
|
||||
worker_connections = 2000
|
||||
# 设置进程文件目录
|
||||
pidfile = 'gunicorn.pid'
|
||||
# 设置访问日志和错误信息日志路径
|
||||
accesslog = '-'
|
||||
errorlog = '-'
|
||||
# 设置日志记录水平
|
||||
loglevel = 'info'
|
||||
# 代码发生变化是否自动重启
|
||||
reload = True
|
||||
50
jd_babel_channel/gunicorn.conf.py
Normal file
50
jd_babel_channel/gunicorn.conf.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
# 工作进程数量
|
||||
workers = 2
|
||||
# 工作模式
|
||||
worker_class = 'gevent'
|
||||
# 每个工作进程的线程数
|
||||
threads = 2
|
||||
# 监听地址和端口
|
||||
bind = '0.0.0.0:5002'
|
||||
# 超时时间
|
||||
timeout = 120
|
||||
# 重载
|
||||
reload = True
|
||||
# 守护进程
|
||||
daemon = False
|
||||
# 工作目录
|
||||
chdir = '/app'
|
||||
# 日志级别
|
||||
loglevel = 'info'
|
||||
# 访问日志
|
||||
accesslog = '/app/logs/access.log'
|
||||
# 错误日志
|
||||
errorlog = '/app/logs/error.log'
|
||||
# 进程名称
|
||||
proc_name = 'gunicorn_babel_channel'
|
||||
# 优雅重启时间
|
||||
graceful_timeout = 120
|
||||
# 最大请求数
|
||||
max_requests = 1000
|
||||
max_requests_jitter = 50
|
||||
# 预加载应用
|
||||
preload_app = True
|
||||
|
||||
# 启动前的钩子
|
||||
def on_starting(server):
|
||||
server.log.info("Starting Gunicorn Server...")
|
||||
|
||||
# 请求开始前的钩子
|
||||
def pre_request(worker, req):
|
||||
worker.log.info(f"Handling request: {req.uri}")
|
||||
|
||||
# 请求结束后的钩子
|
||||
def post_request(worker, req, environ, resp):
|
||||
worker.log.info(f"Completed request: {req.uri}")
|
||||
|
||||
# 工作进程初始化钩子
|
||||
def post_worker_init(worker):
|
||||
worker.log.info("Worker initialized")
|
||||
6333
jd_babel_channel/js/all.js
Normal file
6333
jd_babel_channel/js/all.js
Normal file
File diff suppressed because it is too large
Load Diff
13832
jd_babel_channel/js/captcha_m.js
Normal file
13832
jd_babel_channel/js/captcha_m.js
Normal file
File diff suppressed because one or more lines are too long
25
jd_babel_channel/js/decrypt_des.js
Normal file
25
jd_babel_channel/js/decrypt_des.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const CryptoJS = require("crypto-js");
|
||||
|
||||
function decryptDes(message, key) {
|
||||
const _key = CryptoJS.enc.Utf8.parse(key);
|
||||
const decrypt = CryptoJS.DES.decrypt(message, _key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
|
||||
}
|
||||
|
||||
|
||||
const encryptDes = (message, key) => {
|
||||
const _key = CryptoJS.enc.Utf8.parse(key);
|
||||
const _srcs = CryptoJS.enc.Utf8.parse(key);
|
||||
const encrypted = CryptoJS.DES.encrypt(message, _key, {
|
||||
iv: _srcs,
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return encrypted.toString();
|
||||
};
|
||||
|
||||
const encryData = encryptDes("378423156", "2E1ZMAF88CCE5EBE551FR3E9AA6FF322");
|
||||
console.log(encryData);
|
||||
10804
jd_babel_channel/js/h5st-5.0.js
Normal file
10804
jd_babel_channel/js/h5st-5.0.js
Normal file
File diff suppressed because one or more lines are too long
490
jd_babel_channel/js/h5st4.2.js
Normal file
490
jd_babel_channel/js/h5st4.2.js
Normal file
@@ -0,0 +1,490 @@
|
||||
const CryptoJS = require("crypto-js");
|
||||
|
||||
this.algos = {
|
||||
MD5: CryptoJS.MD5,
|
||||
SHA256: CryptoJS.SHA256,
|
||||
SHA512: CryptoJS.SHA512,
|
||||
HmacSHA256: CryptoJS.HmacSHA256,
|
||||
HmacSHA512: CryptoJS.HmacSHA512,
|
||||
HmacMD5: CryptoJS.HmacMD5,
|
||||
}
|
||||
|
||||
function q_() {
|
||||
var u = 'uct6d0jhqw';
|
||||
var c = V_(u, 6);
|
||||
var l = W_();
|
||||
var i = J_(u, c);
|
||||
var p = {};
|
||||
p.size = l, p.num = i;
|
||||
var h = K_(p) + c + K_({
|
||||
size: 9 - l,
|
||||
num: i
|
||||
}) + l;
|
||||
var s = h.split("");
|
||||
var d = s.slice(0, 14);
|
||||
var a = s.slice(14);
|
||||
var f = [];
|
||||
for (; d.length > 0;) f.push((35 - parseInt(d.pop(), 36)).toString(36));
|
||||
f = f.concat(a);
|
||||
var v = f.join("");
|
||||
return v;
|
||||
}
|
||||
|
||||
function W_() {
|
||||
return (Math.random() * 10) | 0
|
||||
}
|
||||
|
||||
function V_(t, e) {
|
||||
var o, i = [], a = t.length, u = U_(t);
|
||||
try {
|
||||
for (u.s(); !(o = u.n()).done;) {
|
||||
var c = o.value;
|
||||
if (((Math.random() * a) < e) && (i.push(c), 0 == --e)) break;
|
||||
a--
|
||||
}
|
||||
} catch (t) {
|
||||
u.e(t)
|
||||
} finally {
|
||||
u.f()
|
||||
}
|
||||
var s = "";
|
||||
|
||||
for (var l = 0; (l < i.length); l++) {
|
||||
var d = ((Math.random() * (i.length - l)) | 0);
|
||||
s += i[d], i[d] = i[((i.length - l) - 1)]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
function K_(t) {
|
||||
var r = t.size, o = t.num;
|
||||
for (var a = ""; r--;) a += o[((Math.random() * o.length) | 0)];
|
||||
return a
|
||||
}
|
||||
|
||||
function J_(t, e) {
|
||||
for (var a = 0; a < e.length; a++) {
|
||||
var u = t.indexOf(e[a]);
|
||||
(u !== -1) && (t = t.replace(e[a], ""))
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
function U_(t, e) {
|
||||
var p;
|
||||
if ((typeof Symbol === 'undefined') || null == t[Symbol.iterator]) {
|
||||
if (Array.isArray(t) || (p = G_(t)) || (e && t) && (typeof t.length === 'number')) {
|
||||
p && (t = p);
|
||||
var f = 0, l = function () {
|
||||
}, d = {};
|
||||
return d.s = l, d.n = function () {
|
||||
var e = {};
|
||||
if (e.done = !0, f >= t.length) return e;
|
||||
var r = {};
|
||||
return r.done = !1, r.value = t[f++], r
|
||||
}, d.e = function (t) {
|
||||
throw t
|
||||
}, d.f = l, d
|
||||
}
|
||||
throw new TypeError('Invalid attempt to iterate non-iterable instance.In order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
|
||||
}
|
||||
var u, c = !0, s = !1;
|
||||
return {
|
||||
s: function () {
|
||||
p = t[Symbol.iterator]()
|
||||
}, n: function () {
|
||||
var t = p.next();
|
||||
return c = t.done, t
|
||||
}, e: function (t) {
|
||||
s = !0, u = t
|
||||
}, f: function () {
|
||||
try {
|
||||
!c && (p.return != null) && p.return()
|
||||
} finally {
|
||||
if (s) throw u
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function test(mode, tk, fp, ts, ai, rd) {
|
||||
// var rd='u45wCFuLk0qZ';
|
||||
var s_str = "".concat(tk).concat(fp).concat(ts).concat(ai).concat(rd);
|
||||
if (mode === "MD5") {
|
||||
return CryptoJS.MD5(s_str).toString();
|
||||
}
|
||||
if (mode === "SHA256") {
|
||||
return CryptoJS.SHA256(s_str).toString();
|
||||
}
|
||||
if (mode === "SHA512") {
|
||||
return CryptoJS.SHA512(s_str).toString();
|
||||
}
|
||||
if (mode === "HmacSHA256") {
|
||||
return CryptoJS.HmacSHA256(s_str, tk).toString();
|
||||
}
|
||||
if (mode === "HmacSHA512") {
|
||||
return CryptoJS.HmacSHA512(s_str, tk).toString();
|
||||
}
|
||||
if (mode === "HmacMD5") {
|
||||
return CryptoJS.HmacMD5(s_str, tk).toString();
|
||||
}
|
||||
}
|
||||
|
||||
function randomString(t, e) {
|
||||
var a = "", u = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
for (var s = 0; s < t; s++) {
|
||||
var c = u;
|
||||
if (s === 0 && e) {
|
||||
c = u.slice(1);
|
||||
}
|
||||
var f = Math.round((Math.random() * (c.length - 1)));
|
||||
a += c.substring(f, (f + 1))
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
function __genSign(t_string) {
|
||||
return this.algos.SHA256(t_string).toString(CryptoJS.enc.Hex);
|
||||
}
|
||||
|
||||
function expandParams(fp, p) {
|
||||
var r = {
|
||||
"wc": 0,
|
||||
"wd": 0,
|
||||
"l": "zh-CN",
|
||||
"ls": "zh-CN,zh",
|
||||
"ml": 2,
|
||||
"pl": 5,
|
||||
"av": "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
"sua": "Windows NT 10.0; Win64; x64",
|
||||
"pp": {
|
||||
"p1": p,
|
||||
"p2": p
|
||||
},
|
||||
"extend": {
|
||||
"pm": 0,
|
||||
"wd": 0,
|
||||
"l": 0,
|
||||
"ls": 5,
|
||||
"wk": 0,
|
||||
"bu1": "9.9.9"
|
||||
},
|
||||
"pp1": "",
|
||||
"pm": {
|
||||
"ps": "prompt",
|
||||
"np": "default"
|
||||
},
|
||||
"w": 1440,
|
||||
"h": 900,
|
||||
"ow": 1440,
|
||||
"oh": 852,
|
||||
"url": "https://trade.m.jd.com/order/orderlist_jdm.shtml?sceneval=2&jxsid=17120669823577249632&appCode=ms0ca95114&orderType=all&ptag=7155.1.11&source=m_inner_myJd.orderFloor_orderlist",
|
||||
"og": "https://trade.m.jd.com",
|
||||
"pr": 2,
|
||||
"re": "https://my.m.jd.com/",
|
||||
"random": "poGfncluFh",
|
||||
"referer": "https://my.m.jd.com/",
|
||||
"v": "h5_npm_v4.2.0",
|
||||
"ai": "44550",
|
||||
"fp": fp
|
||||
}
|
||||
|
||||
return CryptoJS.AES.encrypt(
|
||||
JSON.stringify(r, null, 2),
|
||||
CryptoJS.enc.Utf8.parse('wm0!@w-s#ll1flo('),
|
||||
{
|
||||
iv: CryptoJS.enc.Utf8.parse('0102030405060708'),
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
}
|
||||
).ciphertext.toString();
|
||||
}
|
||||
|
||||
function build_params(orderId, type) {
|
||||
const Fe = {
|
||||
"pixelRatio": 2,
|
||||
"screenWidth": 1440,
|
||||
"screenHeight": 900,
|
||||
"windowWidth": 291,
|
||||
"windowHeight": 765,
|
||||
"statusBarHeight": null,
|
||||
"safeArea": {
|
||||
"bottom": 0,
|
||||
"height": 0,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"width": 0
|
||||
},
|
||||
"bluetoothEnabled": false,
|
||||
"locationEnabled": false,
|
||||
"wifiEnabled": false,
|
||||
"deviceOrientation": "landscape",
|
||||
"benchmarkLevel": -1,
|
||||
"brand": "",
|
||||
"model": "",
|
||||
"system": null,
|
||||
"platform": "Win32",
|
||||
"SDKVersion": "",
|
||||
"enableDebug": false,
|
||||
"language": "zh-CN",
|
||||
"version": "",
|
||||
"theme": "light",
|
||||
"fontSizeSetting": null,
|
||||
"albumAuthorized": false,
|
||||
"cameraAuthorized": false,
|
||||
"locationAuthorized": false,
|
||||
"microphoneAuthorized": false,
|
||||
"notificationAuthorized": false,
|
||||
"notificationAlertAuthorized": false,
|
||||
"notificationBadgeAuthorized": false,
|
||||
"notificationSoundAuthorized": false,
|
||||
"phoneCalendarAuthorized": false,
|
||||
"locationReducedAccuracy": false,
|
||||
"environment": ""
|
||||
}
|
||||
if (type === "recycle") {
|
||||
const body = {
|
||||
"appType": 3,
|
||||
"bizType": "2",
|
||||
"deviceUUId": "",
|
||||
"platform": 3,
|
||||
"sceneval": "2",
|
||||
"source": "m_inner_myJd.orderFloor_orderlist",
|
||||
"systemBaseInfo": JSON.stringify(Fe),
|
||||
"orderId": orderId,
|
||||
"recycleType": 1,
|
||||
"tenantCode": "jgm",
|
||||
"bizModelCode": "2",
|
||||
"bizModeClientType": "M",
|
||||
"bizModeFramework": "Taro",
|
||||
"externalLoginType": 1,
|
||||
"token": "3852b12f8c4d869b7ed3e2b3c68c9436",
|
||||
"appId": "m91d27dbf599dff74"
|
||||
}
|
||||
return JSON.stringify(body);
|
||||
}
|
||||
if (type === "delete") {
|
||||
const body2 = {
|
||||
"appType": 3,
|
||||
"bizType": "2",
|
||||
"deviceUUId": "",
|
||||
"platform": 3,
|
||||
"source": "-1",
|
||||
"systemBaseInfo": JSON.stringify(Fe),
|
||||
"orderId": orderId,
|
||||
"recycleType": 2,
|
||||
"tenantCode": "jgm",
|
||||
"bizModelCode": "2",
|
||||
"bizModeClientType": "M",
|
||||
"bizModeFramework": "Taro",
|
||||
"externalLoginType": 1,
|
||||
"token": "3852b12f8c4d869b7ed3e2b3c68c9436",
|
||||
"appId": "m91d27dbf599dff74"
|
||||
}
|
||||
return JSON.stringify(body2);
|
||||
}
|
||||
}
|
||||
|
||||
function encrypt_body(orderId, type) {
|
||||
const Fe = {
|
||||
"pixelRatio": 2,
|
||||
"screenWidth": 1440,
|
||||
"screenHeight": 900,
|
||||
"windowWidth": 291,
|
||||
"windowHeight": 765,
|
||||
"statusBarHeight": null,
|
||||
"safeArea": {
|
||||
"bottom": 0,
|
||||
"height": 0,
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"width": 0
|
||||
},
|
||||
"bluetoothEnabled": false,
|
||||
"locationEnabled": false,
|
||||
"wifiEnabled": false,
|
||||
"deviceOrientation": "landscape",
|
||||
"benchmarkLevel": -1,
|
||||
"brand": "",
|
||||
"model": "",
|
||||
"system": null,
|
||||
"platform": "Win32",
|
||||
"SDKVersion": "",
|
||||
"enableDebug": false,
|
||||
"language": "zh-CN",
|
||||
"version": "",
|
||||
"theme": "light",
|
||||
"fontSizeSetting": null,
|
||||
"albumAuthorized": false,
|
||||
"cameraAuthorized": false,
|
||||
"locationAuthorized": false,
|
||||
"microphoneAuthorized": false,
|
||||
"notificationAuthorized": false,
|
||||
"notificationAlertAuthorized": false,
|
||||
"notificationBadgeAuthorized": false,
|
||||
"notificationSoundAuthorized": false,
|
||||
"phoneCalendarAuthorized": false,
|
||||
"locationReducedAccuracy": false,
|
||||
"environment": ""
|
||||
}
|
||||
if (type === "recycle") {
|
||||
const body = {
|
||||
"appType": 3,
|
||||
"bizType": "2",
|
||||
"deviceUUId": "",
|
||||
"platform": 3,
|
||||
"sceneval": "2",
|
||||
"source": "m_inner_myJd.orderFloor_orderlist",
|
||||
"systemBaseInfo": JSON.stringify(Fe),
|
||||
"orderId": orderId,
|
||||
"recycleType": 1,
|
||||
"tenantCode": "jgm",
|
||||
"bizModelCode": "2",
|
||||
"bizModeClientType": "M",
|
||||
"bizModeFramework": "Taro",
|
||||
"externalLoginType": 1,
|
||||
"token": "3852b12f8c4d869b7ed3e2b3c68c9436",
|
||||
"appId": "m91d27dbf599dff74"
|
||||
}
|
||||
const jsonString = JSON.stringify(body)
|
||||
return CryptoJS.SHA256(jsonString).toString(CryptoJS.enc.Hex)
|
||||
}
|
||||
if (type === "delete") {
|
||||
const body2 = {
|
||||
"appType": 3,
|
||||
"bizType": "2",
|
||||
"deviceUUId": "",
|
||||
"platform": 3,
|
||||
"source": "-1",
|
||||
"systemBaseInfo": JSON.stringify(Fe),
|
||||
"orderId": orderId,
|
||||
"recycleType": 2,
|
||||
"tenantCode": "jgm",
|
||||
"bizModelCode": "2",
|
||||
"bizModeClientType": "M",
|
||||
"bizModeFramework": "Taro",
|
||||
"externalLoginType": 1,
|
||||
"token": "3852b12f8c4d869b7ed3e2b3c68c9436",
|
||||
"appId": "m91d27dbf599dff74"
|
||||
}
|
||||
const jsonString = JSON.stringify(body2)
|
||||
return CryptoJS.SHA256(jsonString).toString(CryptoJS.enc.Hex)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function aC(t, r) {
|
||||
var D, B = [], j = t.length, _ = tC(t);
|
||||
try {
|
||||
for (_.s(); !(D = _.n()).done;) {
|
||||
var M = D.value;
|
||||
if (Math.random() * j < r && (B.push(M), --r == 0)) break;
|
||||
j--;
|
||||
}
|
||||
} catch (t) {
|
||||
_.e(t);
|
||||
} finally {
|
||||
_.f();
|
||||
}
|
||||
for (var E = "", O = 0; O < B.length; O++) {
|
||||
var P = (Math.random() * (B.length - O)) | 0;
|
||||
(E += B[P]), (B[P] = B[B.length - O - 1]);
|
||||
}
|
||||
return E;
|
||||
}
|
||||
|
||||
function tC(t, r) {
|
||||
var nt;
|
||||
if (typeof Object.Symbol === "undefined" || null == t[Symbol.iterator]) {
|
||||
if (Array.isArray(t) || (nt = rC(t)) || (r && t && typeof t.length === "number")) {
|
||||
nt && (t = nt);
|
||||
var tt = 0, rt = function () {
|
||||
};
|
||||
return {
|
||||
s: rt, n: function () {
|
||||
var r = {};
|
||||
if (((r.done = !0), tt >= t.length)) return r;
|
||||
var e = {};
|
||||
return (e.done = !1), (e.value = t[tt++]), e;
|
||||
}, e: function (t) {
|
||||
throw t;
|
||||
}, f: rt,
|
||||
};
|
||||
}
|
||||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
var et, ot = !0, it = !1;
|
||||
return {
|
||||
s: function () {
|
||||
nt = t[Symbol.iterator]();
|
||||
}, n: function () {
|
||||
var n = nt.next();
|
||||
return (ot = n.done), n;
|
||||
}, e: function (t) {
|
||||
(it = !0), (et = t);
|
||||
}, f: function () {
|
||||
try {
|
||||
!ot && nt.return != null && nt.return();
|
||||
} finally {
|
||||
if (it) throw et;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function rC(t, r) {
|
||||
if (!t) return;
|
||||
if (typeof t === "string") return nC(t, r);
|
||||
var D = t.slice(8, -1);
|
||||
D === "Object" && t.constructor && (D = t.constructor.name);
|
||||
if (D === "Map" || D === "Set") return Array.from(t);
|
||||
if ("Arguments" === D || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/["test"](D)) return nC(t, r);
|
||||
}
|
||||
|
||||
function nC(t, r) {
|
||||
(r == null || r > t.length) && (r = t.length);
|
||||
for (var h = 0, l = new Array(r); h < r; h++) l[h] = t[h];
|
||||
return l;
|
||||
}
|
||||
|
||||
function uC() {
|
||||
return (10 * Math.random()) | 0;
|
||||
}
|
||||
|
||||
function fC(t, r) {
|
||||
for (var d = 0; d < r.length; d++) {
|
||||
var y = Array.prototype.indexOf.call(t, r[d]);
|
||||
y !== -1 && (t = t.replace(r[d], ""));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
function cC(t) {
|
||||
var _ = t.size, g = t.num;
|
||||
for (var y = ""; _--;) y += g[(Math.random() * g.length) | 0];
|
||||
return y;
|
||||
}
|
||||
|
||||
function iC() {
|
||||
const X = "kl9i1uct6d";
|
||||
const U = aC(X, 3);
|
||||
const et = uC();
|
||||
const J = fC(X, U);
|
||||
const Q = {size: et, num: J};
|
||||
const $ = cC(Q) + U + cC({
|
||||
size: 12 - et, num: J,
|
||||
}) + et;
|
||||
const Z = $.split("");
|
||||
const tt = Array.prototype.slice.call(Z, 0, 10);
|
||||
const V = Array.prototype.slice.call(Z, 10);
|
||||
var nt = [];
|
||||
for (; tt.length > 0;) nt.push((35 - parseInt(tt.pop(), 36)).toString(36));
|
||||
nt = Array.prototype.concat(nt, V);
|
||||
return nt.join("");
|
||||
}
|
||||
|
||||
body = iC()
|
||||
console.log(body);
|
||||
10
jd_babel_channel/js/login.js
Normal file
10
jd_babel_channel/js/login.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const Fingerprint2 = require("fingerprintjs2")
|
||||
|
||||
c = [
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1"
|
||||
]
|
||||
|
||||
b = Fingerprint2.x64hash128(c.join('~~~'), 31)
|
||||
console.log(b)
|
||||
|
||||
|
||||
822
jd_babel_channel/js/login_encrypt.js
Normal file
822
jd_babel_channel/js/login_encrypt.js
Normal file
@@ -0,0 +1,822 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: !0
|
||||
}),
|
||||
exports.getHelpList = getHelpList,
|
||||
exports.getRequest = getRequest,
|
||||
exports.toast = toast,
|
||||
exports.getCookie = getCookie,
|
||||
exports.checkPhone = checkPhone,
|
||||
exports.rsaData = rsaData,
|
||||
exports.encryptLongData = encryptLongData,
|
||||
exports.mdUpdata = mdUpdata,
|
||||
exports.checkLoginName = checkLoginName,
|
||||
exports.checkPassword = checkPassword,
|
||||
exports.checkPasswordAndExtra = checkPasswordAndExtra,
|
||||
exports.pv = pv,
|
||||
exports.reportClick = reportClick,
|
||||
exports.CtoH = CtoH,
|
||||
exports.plReport = plReport,
|
||||
exports.replaceSpecParams = replaceSpecParams,
|
||||
exports.replaceParams = replaceParams,
|
||||
exports.IsInJDApp = IsInJDApp,
|
||||
exports.IsInQQ = IsInQQ,
|
||||
exports.IsInWeixin = IsInWeixin,
|
||||
exports.IsInWxApp = IsInWxApp,
|
||||
exports.clientType = clientType,
|
||||
exports.getParamsValue = getParamsValue,
|
||||
exports.getStorage = getStorage,
|
||||
exports.setStorage = setStorage,
|
||||
exports.removeStorage = removeStorage,
|
||||
exports.applePublicFun = applePublicFun,
|
||||
exports.appleIconFun = appleIconFun,
|
||||
exports.locationReplace = locationReplace,
|
||||
exports.locationNav = locationNav;
|
||||
var window = global;
|
||||
window["navigator"] = {
|
||||
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/131.0.0.0"
|
||||
};
|
||||
var location = {
|
||||
search: "?returnurl=https%3A%2F%2Fmy.m.jd.com%2F"
|
||||
}
|
||||
var document = {
|
||||
cookie: 'guid=15a5d63d6e2df5354db8a05e10cc71ee86f7e9e8fbd83b9cd528a886eb605bf5; lang=chs; wxa_level=1; retina=1; cid=9; jxsid=17350126885402498089; appCode=ms0ca95114; __jdv=122270672%7Cdirect%7C-%7Cnone%7C-%7C1735012688543; __jdc=122270672; mba_muid=17350126885431930885159; webp=1; visitkey=5631589969592143644; 3AB9D23F7A4B3CSS=jdd03PBZHV4O4RF5SAA7QGYPZEPRPAYOCCF3WTUQYMWEFASLCJNYX2HWO7C35L5TYQUL66FGXVVMXDWKTBEEE24LW42XEWMAAAAMT63IJ3WQAAAAAC7XT2RH7VR54QUX; 3AB9D23F7A4B3C9B=PBZHV4O4RF5SAA7QGYPZEPRPAYOCCF3WTUQYMWEFASLCJNYX2HWO7C35L5TYQUL66FGXVVMXDWKTBEEE24LW42XEWM; __wga=1735012688635.1735012688635.1735012688635.1735012688635.1.1; PPRD_P=UUID.17350126885431930885159; jxsid_s_t=1735012688663; jxsid_s_u=https%3A//my.m.jd.com/; shshshfpa=306855fe-8480-967c-1393-fed1c3c06b8b-1711417712; shshshfpx=306855fe-8480-967c-1393-fed1c3c06b8b-1711417712; sc_width=390; equipmentId=PBZHV4O4RF5SAA7QGYPZEPRPAYOCCF3WTUQYMWEFASLCJNYX2HWO7C35L5TYQUL66FGXVVMXDWKTBEEE24LW42XEWM; fingerprint=79377a943fe8b9641376377211ce67d9; deviceVersion=604.1; deviceOS=ios; deviceOSVersion=16.6; deviceName=Safari; __jda=122270672.17350126885431930885159.1735012688.1735012688.1735024144.2; lsid=143622605918790rv3oe3omxwt9kjjfd9cfwy4fpeea2n1735024143544; lstoken=ixi6kf3e; shshshfpb=BApXS7Pt39PZAnvvudsd4yKFal6Z4BtpRBlMAcD1L9xJ1MtISH4AzsnqL7EM; __jd_ref_cls=MLoginRegister_SMSReceiveCode; jcap_dvzw_fp=qIfys8-2qqTBIjANw1ht4O4cAvZHMfHhZDyRWF5HbpVCKSG-5D451Ug5JH8IcXPphYt_ontnLmpYRMyY4sLIIg=='
|
||||
}
|
||||
|
||||
var ua = window.navigator.userAgent.toLowerCase()
|
||||
, language = {
|
||||
chs: {
|
||||
code_4: "密码由 8~20 位字母、数字,或者半角符号组成,不能是10位以下纯数字/字母/半角符号,字母区分大小写。",
|
||||
code_6: "登录密码仅支持字母、数字或半角字符,不可包含空格",
|
||||
code_7: "登录密码长度需在8-20位字符之间",
|
||||
code_8: "登录密码不能是10位以下纯数字/字母/半角符号",
|
||||
code_9: "备注:请将密码设置为8-20位,并且由字母,数字或半角符号组成,不能是10位以下纯数字/字母/半角符号,不能与旧密码相同",
|
||||
code_10: "登录密码长度需在8-20位字符之间",
|
||||
code_11: "重新选择认证方式",
|
||||
code_12: "账号申诉",
|
||||
code_13: "无法接收短信",
|
||||
code_14: "遇到问题?",
|
||||
code_15: "遇到问题?您可以尝试以下方式",
|
||||
code_16: "取消",
|
||||
code_17: "确定",
|
||||
code_18: "账号名由4-20位字符组成,可由字母/数字/中文/-/_及其组合组成,不能为纯数字。",
|
||||
code_19: "账号名不能为纯数字。",
|
||||
code_20: "账号名长度需在4-20位字符之间。"
|
||||
},
|
||||
eng: {
|
||||
code_4: "Password must use 8-20 characters. Include letters (case-sensitive), numbers, or symbols. If using less than 10 characters, must combine different types.",
|
||||
code_6: "The login password only supports letters, numbers, or symbols, and cannot contain spaces.",
|
||||
code_7: "The login password must be between 8 and 20 digits long.",
|
||||
code_8: "If the login password is under 10 digits it must combine numbers/letters/symbols.",
|
||||
code_9: "Note: Please set the password to 8-20 characters, it must be composed of letters, numbers, or symbols. If using less than 10 characters, must combine different types, and it cannot be the same as the old password.",
|
||||
code_10: "The login password must be between 8 and 20 digits long.",
|
||||
code_11: "Re-select the authentication method",
|
||||
code_12: "Account appeal",
|
||||
code_13: "Unable to receive the SMS",
|
||||
code_14: "Having any trouble? ",
|
||||
code_15: "Having any trouble? You can try the following methods",
|
||||
code_16: "Cancel",
|
||||
code_17: "Sure",
|
||||
code_18: "The account name consists of 4-20 characters, and can be composed of letters/numbers/Chinese characters/-/_ and their combination, but cannot be pure numbers.",
|
||||
code_19: "The account name cannot be pure numbers.",
|
||||
code_20: "The account name must be between 4 and 20 characters."
|
||||
},
|
||||
cht: {
|
||||
code_4: "密碼由 8~20 位字母、數字,或者半角符號組成,不能是10位以下純數字/字母/半角符號,字母區分大小寫。",
|
||||
code_6: "登錄密碼僅支持字母、數字或半角字符,不可包含空格",
|
||||
code_7: "登錄密碼長度需在8-20位字符之間",
|
||||
code_8: "登錄密碼不能是10位以下純數字/字母/半角符號",
|
||||
code_9: "備註:請將密碼設置為8-20位,並且由字母,數字或半角符號組成,不能是10位以下純數字/字母/半角符號,不能與舊密碼相同",
|
||||
code_10: "登錄密碼長度需在8-20位字符之間",
|
||||
code_11: "重新選擇認證方式",
|
||||
code_12: "帳號申訴",
|
||||
code_13: "無法接收短信",
|
||||
code_14: "遇到問題?",
|
||||
code_15: "遇到問題?您可以嘗試以下方式",
|
||||
code_16: "取消",
|
||||
code_17: "確定",
|
||||
code_18: "帳號名由4-20位字符組成,可由字母/數字/中文/-/_及其組合組成,不能為純數字。",
|
||||
code_19: "帳號名不能為純數字。",
|
||||
code_20: "帳號名長度需在4-20位字符之間。"
|
||||
}
|
||||
}
|
||||
, lang = exports.lang = getRequest().lang || getCookie("lang") || "chs";
|
||||
|
||||
function getHelpList(t, e, n) {
|
||||
var i = [{
|
||||
text: language[lang].code_11,
|
||||
url: "/findpwd/findmethod"
|
||||
}, {
|
||||
text: language[lang].code_12,
|
||||
url: _config.page.login.dispatch,
|
||||
params: "pin=" + (t && t.encrypt_pin || ""),
|
||||
reportEventid: "MLoginRegister_PswAppeal"
|
||||
}];
|
||||
return e && i.push({
|
||||
text: language[lang].code_13,
|
||||
click: goChangBind,
|
||||
reportEventid: "MLoginRegister_PhoneNumUnUse"
|
||||
}),
|
||||
n ? (0,
|
||||
_extends3.default)({}, n, {
|
||||
modalConfig: (0,
|
||||
_extends3.default)({}, n.modalConfig, {
|
||||
urlList: i
|
||||
})
|
||||
}) : {
|
||||
tipText: language[lang].code_14,
|
||||
reportEventid: "MLoginRegister_PswProblem",
|
||||
showModal: !1,
|
||||
modalConfig: {
|
||||
headerText: language[lang].code_15,
|
||||
urlList: i,
|
||||
footerText: language[lang].code_16
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getRequest() {
|
||||
var t = location.search
|
||||
, e = {};
|
||||
if (-1 !== t.indexOf("?"))
|
||||
for (var n = t.substr(1).split("&"), i = 0; i < n.length; i++)
|
||||
try {
|
||||
var r = n[i].split("=");
|
||||
e[r[0]] = decodeURIComponent(r[1])
|
||||
} catch (t) {
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
function isChinese(t) {
|
||||
return /[^\u0000-\u00FF]/g.test(decodeURI(t))
|
||||
}
|
||||
|
||||
function toast(t) {
|
||||
t.message && (t.message.length > 12 ? (0,
|
||||
_alert2.default)({
|
||||
message: t.message,
|
||||
btn: t.btn || language[lang].code_17
|
||||
}) : (0,
|
||||
_toast2.default)({
|
||||
message: t.message
|
||||
}))
|
||||
}
|
||||
|
||||
function getCookie(t) {
|
||||
var e = document.cookie.match(new RegExp("(^| )" + t + "=([^;]*)($|;)"));
|
||||
return e ? decodeURIComponent(e[2]) : ""
|
||||
}
|
||||
|
||||
function checkPhone(t, e) {
|
||||
return void 0 === e && (e = ""),
|
||||
"" !== e.trim() && (86 === Number(t) ? /^1[3-9][0-9]{9}$/.test(e.trim()) : 852 === Number(t) || 853 === Number(t) || 886 === Number(t) ? /^[0-9]{6,11}$/.test(e.trim()) : /^[0-9]{6,13}$/.test(e.trim()))
|
||||
}
|
||||
|
||||
|
||||
function r(t) {
|
||||
var e = J(R(J(t, this.k - 1), this.mu), this.k + 1)
|
||||
, n = C(K(t, this.k + 1), K(R(e, this.modulus), this.k + 1));
|
||||
n.isNeg && (n = I(n, this.bkplus1));
|
||||
for (var i = U(n, this.modulus) >= 0; i;)
|
||||
i = U(n = C(n, this.modulus), this.modulus) >= 0;
|
||||
return n
|
||||
}
|
||||
|
||||
function o(t, e) {
|
||||
var n = R(t, e);
|
||||
return this.modulo(n)
|
||||
}
|
||||
|
||||
function a(t, e) {
|
||||
var n = new v;
|
||||
n.digits[0] = 1;
|
||||
for (var i = t, r = e; 0 != (1 & r.digits[0]) && (n = this.multiplyMod(n, i)),
|
||||
0 != (r = L(r, 1)).digits[0] || 0 != F(r);)
|
||||
i = this.multiplyMod(i, i);
|
||||
return n
|
||||
}
|
||||
|
||||
var s, c, u, l = 16, d = l, h = 65536, f = h >>> 1, p = h * h, g = h - 1;
|
||||
|
||||
function m(t) {
|
||||
s = new Array(t);
|
||||
for (var e = 0; e < s.length; e++)
|
||||
s[e] = 0;
|
||||
c = new v,
|
||||
(u = new v).digits[0] = 1
|
||||
}
|
||||
|
||||
function v(t) {
|
||||
this.digits = "boolean" == typeof t && 1 == t ? null : s.slice(0),
|
||||
this.isNeg = !1
|
||||
}
|
||||
|
||||
function _(t) {
|
||||
var e = new v(!0);
|
||||
return e.digits = t.digits.slice(0),
|
||||
e.isNeg = t.isNeg,
|
||||
e
|
||||
}
|
||||
|
||||
function y(t) {
|
||||
for (var e = "", n = t.length - 1; n > -1; --n)
|
||||
e += t.charAt(n);
|
||||
return e
|
||||
}
|
||||
|
||||
m(20),
|
||||
function (t) {
|
||||
var e = new v;
|
||||
e.isNeg = t < 0,
|
||||
t = Math.abs(t);
|
||||
for (var n = 0; t > 0;)
|
||||
e.digits[n++] = t & g,
|
||||
t >>= l
|
||||
}(1e15);
|
||||
var b = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
|
||||
|
||||
function w(t, e) {
|
||||
var n = new v;
|
||||
n.digits[0] = e;
|
||||
for (var i = z(t, n), r = b[i[1].digits[0]]; 1 == U(i[0], c);)
|
||||
i = z(i[0], n),
|
||||
digit = i[1].digits[0],
|
||||
r += b[i[1].digits[0]];
|
||||
return (t.isNeg ? "-" : "") + y(r)
|
||||
}
|
||||
|
||||
var k = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
|
||||
|
||||
function x(t) {
|
||||
var e = "";
|
||||
for (i = 0; i < 4; ++i)
|
||||
e += k[15 & t],
|
||||
t >>>= 4;
|
||||
return y(e)
|
||||
}
|
||||
|
||||
function A(t) {
|
||||
for (var e = "", n = (F(t),
|
||||
F(t)); n > -1; --n)
|
||||
e += x(t.digits[n]);
|
||||
return e
|
||||
}
|
||||
|
||||
function T(t) {
|
||||
return t >= 48 && t <= 57 ? t - 48 : t >= 65 && t <= 90 ? 10 + t - 65 : t >= 97 && t <= 122 ? 10 + t - 97 : 0
|
||||
}
|
||||
|
||||
function S(t) {
|
||||
for (var e = 0, n = Math.min(t.length, 4), i = 0; i < n; ++i)
|
||||
e <<= 4,
|
||||
e |= T(t.charCodeAt(i));
|
||||
return e
|
||||
}
|
||||
|
||||
function E(t) {
|
||||
for (var e = new v, n = t.length, i = 0; n > 0; n -= 4,
|
||||
++i)
|
||||
e.digits[i] = S(t.substr(Math.max(n - 4, 0), Math.min(n, 4)));
|
||||
return e
|
||||
}
|
||||
|
||||
function P(t) {
|
||||
for (var e = "", n = F(t); n > -1; --n)
|
||||
e += D(t.digits[n]);
|
||||
return e
|
||||
}
|
||||
|
||||
function D(t) {
|
||||
var e = String.fromCharCode(255 & t);
|
||||
return t >>>= 8,
|
||||
String.fromCharCode(255 & t) + e
|
||||
}
|
||||
|
||||
function I(t, e) {
|
||||
var n;
|
||||
if (t.isNeg != e.isNeg)
|
||||
e.isNeg = !e.isNeg,
|
||||
n = C(t, e),
|
||||
e.isNeg = !e.isNeg;
|
||||
else {
|
||||
n = new v;
|
||||
for (var i, r = 0, o = 0; o < t.digits.length; ++o)
|
||||
i = t.digits[o] + e.digits[o] + r,
|
||||
n.digits[o] = 65535 & i,
|
||||
r = Number(i >= h);
|
||||
n.isNeg = t.isNeg
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
function C(t, e) {
|
||||
var n;
|
||||
if (t.isNeg != e.isNeg)
|
||||
e.isNeg = !e.isNeg,
|
||||
n = I(t, e),
|
||||
e.isNeg = !e.isNeg;
|
||||
else {
|
||||
var i, r;
|
||||
n = new v,
|
||||
r = 0;
|
||||
for (var o = 0; o < t.digits.length; ++o)
|
||||
i = t.digits[o] - e.digits[o] + r,
|
||||
n.digits[o] = 65535 & i,
|
||||
n.digits[o] < 0 && (n.digits[o] += h),
|
||||
r = 0 - Number(i < 0);
|
||||
if (-1 == r) {
|
||||
for (r = 0,
|
||||
o = 0; o < t.digits.length; ++o)
|
||||
i = 0 - n.digits[o] + r,
|
||||
n.digits[o] = 65535 & i,
|
||||
n.digits[o] < 0 && (n.digits[o] += h),
|
||||
r = 0 - Number(i < 0);
|
||||
n.isNeg = !t.isNeg
|
||||
} else
|
||||
n.isNeg = t.isNeg
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
function F(t) {
|
||||
for (var e = t.digits.length - 1; e > 0 && 0 == t.digits[e];)
|
||||
--e;
|
||||
return e
|
||||
}
|
||||
|
||||
function M(t) {
|
||||
var e, n = F(t), i = t.digits[n], r = (n + 1) * d;
|
||||
for (e = r; e > r - d && 0 == (32768 & i); --e)
|
||||
i <<= 1;
|
||||
return e
|
||||
}
|
||||
|
||||
function R(t, e) {
|
||||
for (var n, i, r, o = new v, a = F(t), s = F(e), c = 0; c <= s; ++c) {
|
||||
n = 0,
|
||||
r = c;
|
||||
for (var u = 0; u <= a; ++u,
|
||||
++r)
|
||||
i = o.digits[r] + t.digits[u] * e.digits[c] + n,
|
||||
o.digits[r] = i & g,
|
||||
n = i >>> l;
|
||||
o.digits[c + a + 1] = n
|
||||
}
|
||||
return o.isNeg = t.isNeg != e.isNeg,
|
||||
o
|
||||
}
|
||||
|
||||
function j(t, e) {
|
||||
var n, i, r, o = new v;
|
||||
n = F(t),
|
||||
i = 0;
|
||||
for (var a = 0; a <= n; ++a)
|
||||
r = o.digits[a] + t.digits[a] * e + i,
|
||||
o.digits[a] = r & g,
|
||||
i = r >>> l;
|
||||
return o.digits[1 + n] = i,
|
||||
o
|
||||
}
|
||||
|
||||
function B(t, e, n, i, r) {
|
||||
for (var o = Math.min(e + r, t.length), a = e, s = i; a < o; ++a,
|
||||
++s)
|
||||
n[s] = t[a]
|
||||
}
|
||||
|
||||
var q = new Array(0, 32768, 49152, 57344, 61440, 63488, 64512, 65024, 65280, 65408, 65472, 65504, 65520, 65528, 65532, 65534, 65535);
|
||||
|
||||
function O(t, e) {
|
||||
var n = Math.floor(e / d)
|
||||
, i = new v;
|
||||
B(t.digits, 0, i.digits, n, i.digits.length - n);
|
||||
for (var r = e % d, o = d - r, a = i.digits.length - 1, s = a - 1; a > 0; --a,
|
||||
--s)
|
||||
i.digits[a] = i.digits[a] << r & g | (i.digits[s] & q[r]) >>> o;
|
||||
return i.digits[0] = i.digits[a] << r & g,
|
||||
i.isNeg = t.isNeg,
|
||||
i
|
||||
}
|
||||
|
||||
var N = new Array(0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535);
|
||||
|
||||
function L(t, e) {
|
||||
var n = Math.floor(e / d)
|
||||
, i = new v;
|
||||
B(t.digits, n, i.digits, 0, t.digits.length - n);
|
||||
for (var r = e % d, o = d - r, a = 0, s = a + 1; a < i.digits.length - 1; ++a,
|
||||
++s)
|
||||
i.digits[a] = i.digits[a] >>> r | (i.digits[s] & N[r]) << o;
|
||||
return i.digits[i.digits.length - 1] >>>= r,
|
||||
i.isNeg = t.isNeg,
|
||||
i
|
||||
}
|
||||
|
||||
function H(t, e) {
|
||||
var n = new v;
|
||||
return B(t.digits, 0, n.digits, e, n.digits.length - e),
|
||||
n
|
||||
}
|
||||
|
||||
function J(t, e) {
|
||||
var n = new v;
|
||||
return B(t.digits, e, n.digits, 0, n.digits.length - e),
|
||||
n
|
||||
}
|
||||
|
||||
function K(t, e) {
|
||||
var n = new v;
|
||||
return B(t.digits, 0, n.digits, 0, e),
|
||||
n
|
||||
}
|
||||
|
||||
function U(t, e) {
|
||||
if (t.isNeg != e.isNeg)
|
||||
return 1 - 2 * Number(t.isNeg);
|
||||
for (var n = t.digits.length - 1; n >= 0; --n)
|
||||
if (t.digits[n] != e.digits[n])
|
||||
return t.isNeg ? 1 - 2 * Number(t.digits[n] > e.digits[n]) : 1 - 2 * Number(t.digits[n] < e.digits[n]);
|
||||
return 0
|
||||
}
|
||||
|
||||
function z(t, e) {
|
||||
var n, i, r = M(t), o = M(e), a = e.isNeg;
|
||||
if (r < o)
|
||||
return t.isNeg ? ((n = _(u)).isNeg = !e.isNeg,
|
||||
t.isNeg = !1,
|
||||
e.isNeg = !1,
|
||||
i = C(e, t),
|
||||
t.isNeg = !0,
|
||||
e.isNeg = a) : (n = new v,
|
||||
i = _(t)),
|
||||
new Array(n, i);
|
||||
n = new v,
|
||||
i = t;
|
||||
for (var s = Math.ceil(o / d) - 1, c = 0; e.digits[s] < f;)
|
||||
e = O(e, 1),
|
||||
++c,
|
||||
++o,
|
||||
s = Math.ceil(o / d) - 1;
|
||||
i = O(i, c),
|
||||
r += c;
|
||||
for (var l = Math.ceil(r / d) - 1, m = H(e, l - s); -1 != U(i, m);)
|
||||
++n.digits[l - s],
|
||||
i = C(i, m);
|
||||
for (var y = l; y > s; --y) {
|
||||
var b = y >= i.digits.length ? 0 : i.digits[y]
|
||||
, w = y - 1 >= i.digits.length ? 0 : i.digits[y - 1]
|
||||
, k = y - 2 >= i.digits.length ? 0 : i.digits[y - 2]
|
||||
, x = s >= e.digits.length ? 0 : e.digits[s]
|
||||
, A = s - 1 >= e.digits.length ? 0 : e.digits[s - 1];
|
||||
n.digits[y - s - 1] = b == x ? g : Math.floor((b * h + w) / x);
|
||||
for (var T = n.digits[y - s - 1] * (x * h + A), S = b * p + (w * h + k); T > S;)
|
||||
--n.digits[y - s - 1],
|
||||
T = n.digits[y - s - 1] * (x * h | A),
|
||||
S = b * h * h + (w * h + k);
|
||||
(i = C(i, j(m = H(e, y - s - 1), n.digits[y - s - 1]))).isNeg && (i = I(i, m),
|
||||
--n.digits[y - s - 1])
|
||||
}
|
||||
return i = L(i, c),
|
||||
n.isNeg = t.isNeg != a,
|
||||
t.isNeg && (n = a ? I(n, u) : C(n, u),
|
||||
i = C(e = L(e, c), i)),
|
||||
0 == i.digits[0] && 0 == F(i) && (i.isNeg = !1),
|
||||
new Array(n, i)
|
||||
}
|
||||
|
||||
var V = {
|
||||
NoPadding: "NoPadding",
|
||||
PKCS1Padding: "PKCS1Padding",
|
||||
RawEncoding: "RawEncoding",
|
||||
NumericEncoding: "NumericEncoding"
|
||||
};
|
||||
|
||||
|
||||
_rsa_common2 = {
|
||||
|
||||
default: {
|
||||
RSAAPP: V,
|
||||
setMaxDigits: m,
|
||||
RSAKeyPair: function (t, e, n, i) {
|
||||
this.e = E(t),
|
||||
this.d = E(e),
|
||||
this.m = E(n),
|
||||
this.chunkSize = "number" != typeof i ? 2 * F(this.m) : i / 8,
|
||||
this.radix = 16,
|
||||
this.barrett = new function (t) {
|
||||
this.modulus = _(t),
|
||||
this.k = F(this.modulus) + 1;
|
||||
var e = new v;
|
||||
e.digits[2 * this.k] = 1,
|
||||
this.mu = z(e, this.modulus)[0],
|
||||
this.bkplus1 = new v,
|
||||
this.bkplus1.digits[this.k + 1] = 1,
|
||||
this.modulo = r,
|
||||
this.multiplyMod = o,
|
||||
this.powMod = a
|
||||
}
|
||||
(this.m)
|
||||
},
|
||||
encryptedString: function (t, e, n, i) {
|
||||
var r, o, a, s, c, u, l, d, h, f = new Array, p = e.length, g = "";
|
||||
for (s = "string" == typeof n ? n == V.NoPadding ? 1 : n == V.PKCS1Padding ? 2 : 0 : 0,
|
||||
c = "string" == typeof i && i == V.RawEncoding ? 1 : 0,
|
||||
1 == s ? p > t.chunkSize && (p = t.chunkSize) : 2 == s && p > t.chunkSize - 11 && (p = t.chunkSize - 11),
|
||||
r = 0,
|
||||
o = 2 == s ? p - 1 : t.chunkSize - 1; r < p;)
|
||||
s ? f[o] = e.charCodeAt(r) : f[r] = e.charCodeAt(r),
|
||||
r++,
|
||||
o--;
|
||||
for (1 == s && (r = 0),
|
||||
o = t.chunkSize - p % t.chunkSize; o > 0;) {
|
||||
if (2 == s) {
|
||||
for (u = Math.floor(256 * Math.random()); !u;)
|
||||
u = Math.floor(256 * Math.random());
|
||||
f[r] = u
|
||||
} else
|
||||
f[r] = 0;
|
||||
r++,
|
||||
o--
|
||||
}
|
||||
for (2 == s && (f[p] = 0,
|
||||
f[t.chunkSize - 2] = 2,
|
||||
f[t.chunkSize - 1] = 0),
|
||||
l = f.length,
|
||||
r = 0; r < l; r += t.chunkSize) {
|
||||
for (d = new v,
|
||||
o = 0,
|
||||
a = r; a < r + t.chunkSize; ++o)
|
||||
d.digits[o] = f[a++],
|
||||
d.digits[o] += f[a++] << 8;
|
||||
h = t.barrett.powMod(d, t.e),
|
||||
g += 1 == c ? P(h) : 16 == t.radix ? A(h) : w(h, t.radix)
|
||||
}
|
||||
return g
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function rsaData(t, e) {
|
||||
if (!t)
|
||||
return "";
|
||||
_rsa_common2.default.setMaxDigits(131);
|
||||
var n = new _rsa_common2.default.RSAKeyPair("3", "10001", t, 1024);
|
||||
return window.btoa(_rsa_common2.default.encryptedString(n, encodeURIComponent(e), _rsa_common2.default.RSAAPP.PKCS1Padding, _rsa_common2.default.RSAAPP.RawEncoding))
|
||||
}
|
||||
|
||||
function encryptLongData(t, e, n) {
|
||||
var i = function (t) {
|
||||
return n ? _summerCrypticoMin.SummerCryptico.encryptData(e, t) : rsaData(e, t)
|
||||
}
|
||||
, r = "" + t;
|
||||
if (encodeURIComponent(r).length >= 100) {
|
||||
for (var o = [], a = 0, s = r.length; a < s; a += 10) {
|
||||
var c = r.substring(a, a + 10);
|
||||
o.push(i(c))
|
||||
}
|
||||
return {
|
||||
isLong: !0,
|
||||
data: (0,
|
||||
_stringify2.default)(o)
|
||||
}
|
||||
}
|
||||
return {
|
||||
isLong: !1,
|
||||
data: i(r)
|
||||
}
|
||||
}
|
||||
|
||||
function mdUpdata(t, e) {
|
||||
try {
|
||||
var n = t
|
||||
, i = new MPing.inputs.Click(n);
|
||||
e && (i.event_param = (0,
|
||||
_stringify2.default)(e)),
|
||||
i.page_name = window.location.host + window.location.pathname,
|
||||
i.updateEventSeries(),
|
||||
(new MPing).send(i)
|
||||
} catch (t) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkLoginName(t) {
|
||||
var e = {
|
||||
status: !1,
|
||||
msg: ""
|
||||
};
|
||||
return 0 !== t.length && /^[\u4E00-\u9FA5A-Za-z0-9_-]+$/.test(t) ? t.length < 4 || t.length > 20 ? e.msg = language[lang].code_20 : /^\d$/.test(t) ? e.msg = language[lang].code_19 : e.status = !0 : e.msg = language[lang].code_18,
|
||||
e
|
||||
}
|
||||
|
||||
function checkPassword(t) {
|
||||
var e = {
|
||||
status: !1,
|
||||
msg: ""
|
||||
};
|
||||
return 0 === t.length ? e.msg = language[lang].code_4 : !/^[A-Za-z0-9_\\-\W]+$/.test(t) || t.match(/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/g) ? e.msg = language[lang].code_6 : t.length < 8 || t.length > 20 ? e.msg = language[lang].code_7 : t.length <= 9 && !/^(?![a-zA-z]+$)(?!\d+$)(?![\W]+$)[a-zA-Z\d\W]+$/.test(t) ? e.msg = language[lang].code_8 : e.status = !0,
|
||||
e
|
||||
}
|
||||
|
||||
function checkPasswordAndExtra(t, e) {
|
||||
var n = "207" === e
|
||||
, i = {
|
||||
status: !1,
|
||||
msg: ""
|
||||
};
|
||||
return 0 === t.length ? i.msg = n ? language[lang].code_9 : language[lang].code_4 : /^[A-Za-z0-9_\\-\W]+$/.test(t) ? n && (t.length < 8 || t.length > 20) ? i.msg = language[lang].code_7 : t.length <= 9 && !/^(?![a-zA-z]+$)(?!\d+$)(?![\W]+$)[a-zA-Z\d\W]+$/.test(t) ? i.msg = language[lang].code_8 : i.status = !0 : i.msg = language[lang].code_6,
|
||||
i
|
||||
}
|
||||
|
||||
function getChangeBindRequest() {
|
||||
var t = decodeURIComponent(location.search)
|
||||
, e = new Object;
|
||||
if (-1 != t.indexOf("?"))
|
||||
for (var n = t.substr(1).split("&"), i = 0; i < n.length; i++)
|
||||
e[n[i].split("=")[0]] = unescape(n[i].split("=")[1]);
|
||||
return e
|
||||
}
|
||||
|
||||
function pv(t, e) {
|
||||
try {
|
||||
var n = new MPing.inputs.PV;
|
||||
n.page_name = t,
|
||||
e && (n.page_param = e),
|
||||
(new MPing).send(n)
|
||||
} catch (t) {
|
||||
}
|
||||
}
|
||||
|
||||
function reportClick(t) {
|
||||
try {
|
||||
var e = t.eventId
|
||||
, n = t.jsonParam
|
||||
, i = new window.MPing.inputs.Click(e);
|
||||
i.json_param = (0,
|
||||
_stringify2.default)(n),
|
||||
i.updateEventSeries(),
|
||||
(new window.MPing).send(i)
|
||||
} catch (t) {
|
||||
console.log("上报失败")
|
||||
}
|
||||
}
|
||||
|
||||
function CtoH(t) {
|
||||
for (var e = "", n = t.value, i = t.selectionEnd, r = 0; r < n.length; r++)
|
||||
12288 !== n.charCodeAt(r) ? n.charCodeAt(r) > 65280 && n.charCodeAt(r) < 65375 ? e += String.fromCharCode(n.charCodeAt(r) - 65248) : e += String.fromCharCode(n.charCodeAt(r)) : e += String.fromCharCode(n.charCodeAt(r) - 12256);
|
||||
t.value = e,
|
||||
t.setSelectionRange(i, i)
|
||||
}
|
||||
|
||||
function plReport(t, e, n, i) {
|
||||
window.pl_report({
|
||||
interfaceID: t,
|
||||
loginName: e,
|
||||
callTime: n,
|
||||
status: i
|
||||
})
|
||||
}
|
||||
|
||||
function replaceSpecParams(t, e, n) {
|
||||
var i = {}
|
||||
, r = "";
|
||||
if (-1 !== t.indexOf("?"))
|
||||
for (var o = t.substr(1).split("&"), a = 0; a < o.length; a++) {
|
||||
var s = o[a].split("=")[1];
|
||||
i[o[a].split("=")[0]] = i[o[a].split("=")[0]] ? i[o[a].split("=")[0]] + "&" + i[o[a].split("=")[0]] + "=" + unescape(s) : s
|
||||
}
|
||||
for (var c in e && (i[e] = n),
|
||||
i)
|
||||
r = (r ? r + "&" : "") + c + "=" + i[c];
|
||||
return "?" + r
|
||||
}
|
||||
|
||||
function replaceParams(url, arg, val) {
|
||||
var pattern = arg + "=([^&]*)"
|
||||
, replaceText = arg + "=" + val;
|
||||
return url.match(pattern) ? url.replace(eval("/(" + arg + "=)([^&]*)/gi"), replaceText) : url.match("[?]") ? url + "&" + replaceText : url + "?" + replaceText
|
||||
}
|
||||
|
||||
function IsInJDApp() {
|
||||
return -1 !== ua.indexOf("jdapp") || -1 !== ua.indexOf("walletclient") || -1 !== ua.indexOf("toplife") || -1 !== ua.indexOf(" skapp") || -1 !== ua.indexOf("jdjr-app")
|
||||
}
|
||||
|
||||
function IsInQQ() {
|
||||
return -1 !== ua.indexOf(" qq") || -1 !== ua.indexOf("mqqbrowser")
|
||||
}
|
||||
|
||||
function IsInWeixin() {
|
||||
return -1 !== ua.indexOf("micromessenger")
|
||||
}
|
||||
|
||||
function IsInWxApp() {
|
||||
return IsInWeixin() && -1 !== ua.indexOf("miniprogram")
|
||||
}
|
||||
|
||||
function clientType() {
|
||||
return IsInJDApp() ? "app" : IsInQQ() ? "qq" : IsInWeixin() ? "wx" : IsInWxApp() ? "wxapp" : "m"
|
||||
}
|
||||
|
||||
function getParamsValue(t) {
|
||||
var e = new RegExp("(^|&)" + t + "=([^&]*)(&|$)", "i")
|
||||
, n = window.location.search.substr(1).match(e);
|
||||
return null != n ? isChinese(n[2]) ? decodeURI(n[2]) : unescape(n[2]) : null
|
||||
}
|
||||
|
||||
function getStorage(t) {
|
||||
try {
|
||||
return JSON.parse(window.localStorage.getItem(t))
|
||||
} catch (t) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function setStorage(t, e) {
|
||||
try {
|
||||
window.localStorage.setItem(t, (0,
|
||||
_stringify2.default)(e))
|
||||
} catch (t) {
|
||||
}
|
||||
}
|
||||
|
||||
function removeStorage(t) {
|
||||
try {
|
||||
window.localStorage.removeItem(t)
|
||||
} catch (t) {
|
||||
}
|
||||
}
|
||||
|
||||
function applePublicFun(t, e, n) {
|
||||
AppleID.auth.init({
|
||||
clientId: t,
|
||||
scope: "email",
|
||||
redirectURI: e,
|
||||
state: n
|
||||
})
|
||||
}
|
||||
|
||||
function appleIconFun() {
|
||||
AppleID.auth.signIn()
|
||||
}
|
||||
|
||||
function locationReplace(t) {
|
||||
baseNav(t, function (t) {
|
||||
window.location.replace(t)
|
||||
})
|
||||
}
|
||||
|
||||
function locationNav(t) {
|
||||
baseNav(t, function (t) {
|
||||
window.location.href = t
|
||||
})
|
||||
}
|
||||
|
||||
function baseNav(t, e) {
|
||||
try {
|
||||
t && !/javascript:(\/\/)?/gi.test(t) ? e(t) : ((0,
|
||||
_dralog.expLog)(1001, "异常跳转", 3, {
|
||||
url: t,
|
||||
curUrl: window.location.href
|
||||
}),
|
||||
setTimeout(function () {
|
||||
return e("https://m.jd.com")
|
||||
}, 200))
|
||||
} catch (t) {
|
||||
setTimeout(function () {
|
||||
return e("https://m.jd.com")
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
|
||||
var certificateTypes = exports.certificateTypes = [{
|
||||
name: "身份证",
|
||||
value: "1"
|
||||
}, {
|
||||
name: "港澳居民居住证",
|
||||
value: "2"
|
||||
}, {
|
||||
name: "台湾居民居住证",
|
||||
value: "3"
|
||||
}, {
|
||||
name: "外国人永久居留身份证",
|
||||
value: "4"
|
||||
}]
|
||||
, isAndroid = exports.isAndroid = -1 !== ua.indexOf("android")
|
||||
, isJD = exports.isJD = -1 !== ua.indexOf("jdapp")
|
||||
, isJDJR = exports.isJDJR = -1 !== ua.indexOf("jdjr-app")
|
||||
|
||||
console.log(rsaData(
|
||||
"E710C1CE1A8B580F69393020157514EB96AC72997AF751CE041BE799BC9EF112031F5F9709F2362B25ED0CB7173A0FFCB012A40EA015063DEEFA137F137C88788752D5B4D538DE123A46AF95901BC4626DD012917FA1B0973F0B44A8427A7A3FDDAD087316F8CAE594705256F4D8B5C889ABAA886A8C9CE32697A48F4548ADB9",
|
||||
"13246264209"
|
||||
));
|
||||
|
||||
|
||||
const Fingerprint2 = require("fingerprintjs2")
|
||||
|
||||
c = [
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1"
|
||||
]
|
||||
|
||||
function get_fp() {
|
||||
return Fingerprint2.x64hash128(c.join('~~~'), 31)
|
||||
}
|
||||
41032
jd_babel_channel/js/modules.js
Normal file
41032
jd_babel_channel/js/modules.js
Normal file
File diff suppressed because one or more lines are too long
41370
jd_babel_channel/js/user_encrypt.js
Normal file
41370
jd_babel_channel/js/user_encrypt.js
Normal file
File diff suppressed because it is too large
Load Diff
29
jd_babel_channel/logger.py
Normal file
29
jd_babel_channel/logger.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from loguru import logger
|
||||
import sys
|
||||
import pytz
|
||||
from datetime import datetime
|
||||
|
||||
# 移除默认的日志处理器
|
||||
logger.remove()
|
||||
|
||||
# 设置中国时区
|
||||
china_tz = pytz.timezone("Asia/Shanghai")
|
||||
|
||||
|
||||
# 自定义时间格式函数
|
||||
def custom_time():
|
||||
return datetime.now(china_tz).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
# 添加新的处理器,输出到控制台
|
||||
logger.add(sys.stdout, format="{time:YYYY-MM-DD HH:mm:ss} {level} {message}", level="INFO", serialize=False)
|
||||
|
||||
# 添加文件日志处理器
|
||||
logger.add("giftcard.log", rotation="20 MB", retention="30 days", format="{time:YYYY-MM-DD HH:mm:ss} {level} {message}")
|
||||
|
||||
# 创建一个带有时间信息的 Logger
|
||||
logger = logger.bind(time=custom_time())
|
||||
|
||||
|
||||
def get_logger():
|
||||
return logger
|
||||
35
jd_babel_channel/logging.conf
Normal file
35
jd_babel_channel/logging.conf
Normal file
@@ -0,0 +1,35 @@
|
||||
[loggers]
|
||||
keys=root,app
|
||||
|
||||
[handlers]
|
||||
keys=consoleHandler,fileHandler
|
||||
|
||||
[formatters]
|
||||
keys=simpleFormatter
|
||||
|
||||
[logger_root]
|
||||
level=INFO
|
||||
handlers=consoleHandler,fileHandler
|
||||
|
||||
[logger_app]
|
||||
level=INFO
|
||||
handlers=consoleHandler,fileHandler
|
||||
qualname=app
|
||||
propagate=0
|
||||
|
||||
[handler_consoleHandler]
|
||||
class=StreamHandler
|
||||
level=INFO
|
||||
formatter=simpleFormatter
|
||||
args=(sys.stdout,)
|
||||
|
||||
[handler_fileHandler]
|
||||
class=handlers.RotatingFileHandler
|
||||
level=INFO
|
||||
formatter=simpleFormatter
|
||||
args=('/app/logs/app.log', 'a', 10485760, 5)
|
||||
encoding=utf8
|
||||
|
||||
[formatter_simpleFormatter]
|
||||
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
|
||||
datefmt=%Y-%m-%d %H:%M:%S
|
||||
929
jd_babel_channel/package-lock.json
generated
Normal file
929
jd_babel_channel/package-lock.json
generated
Normal file
@@ -0,0 +1,929 @@
|
||||
{
|
||||
"name": "jd_babel_channel",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0",
|
||||
"deasync": "^0.1.30",
|
||||
"fingerprintjs2": "^2.1.4",
|
||||
"jsdom": "^26.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/css-color": {
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmmirror.com/@asamuzakjp/css-color/-/css-color-2.8.3.tgz",
|
||||
"integrity": "sha512-GIc76d9UI1hCvOATjZPyHFmE5qhRccp3/zGfMPapK3jBi+yocEzp6BBB0UnfRYP9NP4FANqUZYb0hnfs3TM3hw==",
|
||||
"dependencies": {
|
||||
"@csstools/css-calc": "^2.1.1",
|
||||
"@csstools/css-color-parser": "^3.0.7",
|
||||
"@csstools/css-parser-algorithms": "^3.0.4",
|
||||
"@csstools/css-tokenizer": "^3.0.3",
|
||||
"lru-cache": "^10.4.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/color-helpers": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/color-helpers/-/color-helpers-5.0.1.tgz",
|
||||
"integrity": "sha512-MKtmkA0BX87PKaO1NFRTFH+UnkgnmySQOvNxJubsadusqPEC2aJ9MOQiMceZJJ6oitUl/i0L6u0M1IrmAOmgBA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/csstools"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/csstools"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/css-calc": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-calc/-/css-calc-2.1.1.tgz",
|
||||
"integrity": "sha512-rL7kaUnTkL9K+Cvo2pnCieqNpTKgQzy5f+N+5Iuko9HAoasP+xgprVh7KN/MaJVvVL1l0EzQq2MoqBHKSrDrag==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/csstools"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/csstools"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@csstools/css-parser-algorithms": "^3.0.4",
|
||||
"@csstools/css-tokenizer": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/css-color-parser": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-color-parser/-/css-color-parser-3.0.7.tgz",
|
||||
"integrity": "sha512-nkMp2mTICw32uE5NN+EsJ4f5N+IGFeCFu4bGpiKgb2Pq/7J/MpyLBeQ5ry4KKtRFZaYs6sTmcMYrSRIyj5DFKA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/csstools"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/csstools"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@csstools/color-helpers": "^5.0.1",
|
||||
"@csstools/css-calc": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@csstools/css-parser-algorithms": "^3.0.4",
|
||||
"@csstools/css-tokenizer": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/css-parser-algorithms": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.4.tgz",
|
||||
"integrity": "sha512-Up7rBoV77rv29d3uKHUIVubz1BTcgyUK72IvCQAbfbMv584xHcGKCKbWh7i8hPrRJ7qU4Y8IO3IY9m+iTB7P3A==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/csstools"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/csstools"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@csstools/css-tokenizer": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/css-tokenizer": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-tokenizer/-/css-tokenizer-3.0.3.tgz",
|
||||
"integrity": "sha512-UJnjoFsmxfKUdNYdWgOB0mWUypuLvAfQPH1+pyvRJs6euowbFkFC6P13w1l8mJyi3vxYMxc9kld5jZEGRQs6bw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/csstools"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/csstools"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-7.1.3.tgz",
|
||||
"integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"dependencies": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cssstyle": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/cssstyle/-/cssstyle-4.2.1.tgz",
|
||||
"integrity": "sha512-9+vem03dMXG7gDmZ62uqmRiMRNtinIZ9ZyuF6BdxzfOD+FdN5hretzynkn0ReS2DO2GSw76RWHs0UmJPI2zUjw==",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/css-color": "^2.8.2",
|
||||
"rrweb-cssom": "^0.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/data-urls": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/data-urls/-/data-urls-5.0.0.tgz",
|
||||
"integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==",
|
||||
"dependencies": {
|
||||
"whatwg-mimetype": "^4.0.0",
|
||||
"whatwg-url": "^14.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/deasync": {
|
||||
"version": "0.1.30",
|
||||
"resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.30.tgz",
|
||||
"integrity": "sha512-OaAjvEQuQ9tJsKG4oHO9nV1UHTwb2Qc2+fadB0VeVtD0Z9wiG1XPGLJ4W3aLhAoQSYTaLROFRbd5X20Dkzf7MQ==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
"node-addon-api": "^1.7.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decimal.js": {
|
||||
"version": "10.4.3",
|
||||
"resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz",
|
||||
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"node_modules/fingerprintjs2": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmmirror.com/fingerprintjs2/-/fingerprintjs2-2.1.4.tgz",
|
||||
"integrity": "sha512-veP2yVsnYvjDVkzZMyIEwpqCAQfsBLH+U4PK5MlFAnLjZrttbdRqEArE1fPcnJFz5oS5CrdONbsV7J6FGpIJEQ==",
|
||||
"deprecated": "Package has been renamed to @fingerprintjs/fingerprintjs. Install @fingerprintjs/fingerprintjs to get updates.",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.1.tgz",
|
||||
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/html-encoding-sniffer": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
|
||||
"integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
|
||||
"dependencies": {
|
||||
"whatwg-encoding": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/http-proxy-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
|
||||
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-potential-custom-element-name": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
|
||||
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="
|
||||
},
|
||||
"node_modules/jsdom": {
|
||||
"version": "26.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/jsdom/-/jsdom-26.0.0.tgz",
|
||||
"integrity": "sha512-BZYDGVAIriBWTpIxYzrXjv3E/4u8+/pSG5bQdIYCbNCGOvsPkDQfTVLAIXAf9ETdCpduCVTkDe2NNZ8NIwUVzw==",
|
||||
"dependencies": {
|
||||
"cssstyle": "^4.2.1",
|
||||
"data-urls": "^5.0.0",
|
||||
"decimal.js": "^10.4.3",
|
||||
"form-data": "^4.0.1",
|
||||
"html-encoding-sniffer": "^4.0.0",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"nwsapi": "^2.2.16",
|
||||
"parse5": "^7.2.1",
|
||||
"rrweb-cssom": "^0.8.0",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^5.0.0",
|
||||
"w3c-xmlserializer": "^5.0.0",
|
||||
"webidl-conversions": "^7.0.0",
|
||||
"whatwg-encoding": "^3.1.1",
|
||||
"whatwg-mimetype": "^4.0.0",
|
||||
"whatwg-url": "^14.1.0",
|
||||
"ws": "^8.18.0",
|
||||
"xml-name-validator": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "10.4.3",
|
||||
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.4.3.tgz",
|
||||
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/node-addon-api": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg=="
|
||||
},
|
||||
"node_modules/nwsapi": {
|
||||
"version": "2.2.16",
|
||||
"resolved": "https://registry.npmmirror.com/nwsapi/-/nwsapi-2.2.16.tgz",
|
||||
"integrity": "sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ=="
|
||||
},
|
||||
"node_modules/parse5": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/parse5/-/parse5-7.2.1.tgz",
|
||||
"integrity": "sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==",
|
||||
"dependencies": {
|
||||
"entities": "^4.5.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/rrweb-cssom": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmmirror.com/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
|
||||
"integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw=="
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/saxes": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/saxes/-/saxes-6.0.0.tgz",
|
||||
"integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
|
||||
"dependencies": {
|
||||
"xmlchars": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=v12.22.7"
|
||||
}
|
||||
},
|
||||
"node_modules/symbol-tree": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmmirror.com/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
|
||||
},
|
||||
"node_modules/tldts": {
|
||||
"version": "6.1.73",
|
||||
"resolved": "https://registry.npmmirror.com/tldts/-/tldts-6.1.73.tgz",
|
||||
"integrity": "sha512-/h4bVmuEMm57c2uCiAf1Q9mlQk7cA22m+1Bu0K92vUUtTVT9D4mOFWD9r4WQuTULcG9eeZtNKhLl0Il1LdKGog==",
|
||||
"dependencies": {
|
||||
"tldts-core": "^6.1.73"
|
||||
},
|
||||
"bin": {
|
||||
"tldts": "bin/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/tldts-core": {
|
||||
"version": "6.1.73",
|
||||
"resolved": "https://registry.npmmirror.com/tldts-core/-/tldts-core-6.1.73.tgz",
|
||||
"integrity": "sha512-k1g5eX87vxu3g//6XMn62y4qjayu4cYby/PF7Ksnh4F4uUK1Z1ze/mJ4a+y5OjdJ+cXRp+YTInZhH+FGdUWy1w=="
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/tough-cookie/-/tough-cookie-5.1.0.tgz",
|
||||
"integrity": "sha512-rvZUv+7MoBYTiDmFPBrhL7Ujx9Sk+q9wwm22x8c8T5IJaR+Wsyc7TNxbVxo84kZoRJZZMazowFLqpankBEQrGg==",
|
||||
"dependencies": {
|
||||
"tldts": "^6.1.32"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/tr46/-/tr46-5.0.0.tgz",
|
||||
"integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==",
|
||||
"dependencies": {
|
||||
"punycode": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-xmlserializer": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
|
||||
"integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
|
||||
"dependencies": {
|
||||
"xml-name-validator": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-encoding": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
|
||||
"integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
|
||||
"dependencies": {
|
||||
"iconv-lite": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-mimetype": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
|
||||
"integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "14.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-14.1.0.tgz",
|
||||
"integrity": "sha512-jlf/foYIKywAt3x/XWKZ/3rz8OSJPiWktjmk891alJUEjiVxKX9LEO92qH3hv4aJ0mN3MWPvGMCy8jQi95xK4w==",
|
||||
"dependencies": {
|
||||
"tr46": "^5.0.0",
|
||||
"webidl-conversions": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.18.0",
|
||||
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz",
|
||||
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xml-name-validator": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
|
||||
"integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/xmlchars": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/xmlchars/-/xmlchars-2.2.0.tgz",
|
||||
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@asamuzakjp/css-color": {
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmmirror.com/@asamuzakjp/css-color/-/css-color-2.8.3.tgz",
|
||||
"integrity": "sha512-GIc76d9UI1hCvOATjZPyHFmE5qhRccp3/zGfMPapK3jBi+yocEzp6BBB0UnfRYP9NP4FANqUZYb0hnfs3TM3hw==",
|
||||
"requires": {
|
||||
"@csstools/css-calc": "^2.1.1",
|
||||
"@csstools/css-color-parser": "^3.0.7",
|
||||
"@csstools/css-parser-algorithms": "^3.0.4",
|
||||
"@csstools/css-tokenizer": "^3.0.3",
|
||||
"lru-cache": "^10.4.3"
|
||||
}
|
||||
},
|
||||
"@csstools/color-helpers": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/color-helpers/-/color-helpers-5.0.1.tgz",
|
||||
"integrity": "sha512-MKtmkA0BX87PKaO1NFRTFH+UnkgnmySQOvNxJubsadusqPEC2aJ9MOQiMceZJJ6oitUl/i0L6u0M1IrmAOmgBA=="
|
||||
},
|
||||
"@csstools/css-calc": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-calc/-/css-calc-2.1.1.tgz",
|
||||
"integrity": "sha512-rL7kaUnTkL9K+Cvo2pnCieqNpTKgQzy5f+N+5Iuko9HAoasP+xgprVh7KN/MaJVvVL1l0EzQq2MoqBHKSrDrag==",
|
||||
"requires": {}
|
||||
},
|
||||
"@csstools/css-color-parser": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-color-parser/-/css-color-parser-3.0.7.tgz",
|
||||
"integrity": "sha512-nkMp2mTICw32uE5NN+EsJ4f5N+IGFeCFu4bGpiKgb2Pq/7J/MpyLBeQ5ry4KKtRFZaYs6sTmcMYrSRIyj5DFKA==",
|
||||
"requires": {
|
||||
"@csstools/color-helpers": "^5.0.1",
|
||||
"@csstools/css-calc": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"@csstools/css-parser-algorithms": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.4.tgz",
|
||||
"integrity": "sha512-Up7rBoV77rv29d3uKHUIVubz1BTcgyUK72IvCQAbfbMv584xHcGKCKbWh7i8hPrRJ7qU4Y8IO3IY9m+iTB7P3A==",
|
||||
"requires": {}
|
||||
},
|
||||
"@csstools/css-tokenizer": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/@csstools/css-tokenizer/-/css-tokenizer-3.0.3.tgz",
|
||||
"integrity": "sha512-UJnjoFsmxfKUdNYdWgOB0mWUypuLvAfQPH1+pyvRJs6euowbFkFC6P13w1l8mJyi3vxYMxc9kld5jZEGRQs6bw=="
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-7.1.3.tgz",
|
||||
"integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw=="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"requires": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||
},
|
||||
"cssstyle": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/cssstyle/-/cssstyle-4.2.1.tgz",
|
||||
"integrity": "sha512-9+vem03dMXG7gDmZ62uqmRiMRNtinIZ9ZyuF6BdxzfOD+FdN5hretzynkn0ReS2DO2GSw76RWHs0UmJPI2zUjw==",
|
||||
"requires": {
|
||||
"@asamuzakjp/css-color": "^2.8.2",
|
||||
"rrweb-cssom": "^0.8.0"
|
||||
}
|
||||
},
|
||||
"data-urls": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/data-urls/-/data-urls-5.0.0.tgz",
|
||||
"integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==",
|
||||
"requires": {
|
||||
"whatwg-mimetype": "^4.0.0",
|
||||
"whatwg-url": "^14.0.0"
|
||||
}
|
||||
},
|
||||
"deasync": {
|
||||
"version": "0.1.30",
|
||||
"resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.30.tgz",
|
||||
"integrity": "sha512-OaAjvEQuQ9tJsKG4oHO9nV1UHTwb2Qc2+fadB0VeVtD0Z9wiG1XPGLJ4W3aLhAoQSYTaLROFRbd5X20Dkzf7MQ==",
|
||||
"requires": {
|
||||
"bindings": "^1.5.0",
|
||||
"node-addon-api": "^1.7.1"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"requires": {
|
||||
"ms": "^2.1.3"
|
||||
}
|
||||
},
|
||||
"decimal.js": {
|
||||
"version": "10.4.3",
|
||||
"resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz",
|
||||
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||
},
|
||||
"entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"fingerprintjs2": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmmirror.com/fingerprintjs2/-/fingerprintjs2-2.1.4.tgz",
|
||||
"integrity": "sha512-veP2yVsnYvjDVkzZMyIEwpqCAQfsBLH+U4PK5MlFAnLjZrttbdRqEArE1fPcnJFz5oS5CrdONbsV7J6FGpIJEQ=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.1.tgz",
|
||||
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"html-encoding-sniffer": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
|
||||
"integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
|
||||
"requires": {
|
||||
"whatwg-encoding": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"http-proxy-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
|
||||
"requires": {
|
||||
"agent-base": "^7.1.0",
|
||||
"debug": "^4.3.4"
|
||||
}
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
|
||||
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
|
||||
"requires": {
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "4"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
}
|
||||
},
|
||||
"is-potential-custom-element-name": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
|
||||
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="
|
||||
},
|
||||
"jsdom": {
|
||||
"version": "26.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/jsdom/-/jsdom-26.0.0.tgz",
|
||||
"integrity": "sha512-BZYDGVAIriBWTpIxYzrXjv3E/4u8+/pSG5bQdIYCbNCGOvsPkDQfTVLAIXAf9ETdCpduCVTkDe2NNZ8NIwUVzw==",
|
||||
"requires": {
|
||||
"cssstyle": "^4.2.1",
|
||||
"data-urls": "^5.0.0",
|
||||
"decimal.js": "^10.4.3",
|
||||
"form-data": "^4.0.1",
|
||||
"html-encoding-sniffer": "^4.0.0",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"nwsapi": "^2.2.16",
|
||||
"parse5": "^7.2.1",
|
||||
"rrweb-cssom": "^0.8.0",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^5.0.0",
|
||||
"w3c-xmlserializer": "^5.0.0",
|
||||
"webidl-conversions": "^7.0.0",
|
||||
"whatwg-encoding": "^3.1.1",
|
||||
"whatwg-mimetype": "^4.0.0",
|
||||
"whatwg-url": "^14.1.0",
|
||||
"ws": "^8.18.0",
|
||||
"xml-name-validator": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"lru-cache": {
|
||||
"version": "10.4.3",
|
||||
"resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.4.3.tgz",
|
||||
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"requires": {
|
||||
"mime-db": "1.52.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node-addon-api": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg=="
|
||||
},
|
||||
"nwsapi": {
|
||||
"version": "2.2.16",
|
||||
"resolved": "https://registry.npmmirror.com/nwsapi/-/nwsapi-2.2.16.tgz",
|
||||
"integrity": "sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ=="
|
||||
},
|
||||
"parse5": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/parse5/-/parse5-7.2.1.tgz",
|
||||
"integrity": "sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==",
|
||||
"requires": {
|
||||
"entities": "^4.5.0"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
||||
},
|
||||
"rrweb-cssom": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmmirror.com/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
|
||||
"integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"saxes": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/saxes/-/saxes-6.0.0.tgz",
|
||||
"integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
|
||||
"requires": {
|
||||
"xmlchars": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"symbol-tree": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmmirror.com/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
|
||||
},
|
||||
"tldts": {
|
||||
"version": "6.1.73",
|
||||
"resolved": "https://registry.npmmirror.com/tldts/-/tldts-6.1.73.tgz",
|
||||
"integrity": "sha512-/h4bVmuEMm57c2uCiAf1Q9mlQk7cA22m+1Bu0K92vUUtTVT9D4mOFWD9r4WQuTULcG9eeZtNKhLl0Il1LdKGog==",
|
||||
"requires": {
|
||||
"tldts-core": "^6.1.73"
|
||||
}
|
||||
},
|
||||
"tldts-core": {
|
||||
"version": "6.1.73",
|
||||
"resolved": "https://registry.npmmirror.com/tldts-core/-/tldts-core-6.1.73.tgz",
|
||||
"integrity": "sha512-k1g5eX87vxu3g//6XMn62y4qjayu4cYby/PF7Ksnh4F4uUK1Z1ze/mJ4a+y5OjdJ+cXRp+YTInZhH+FGdUWy1w=="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/tough-cookie/-/tough-cookie-5.1.0.tgz",
|
||||
"integrity": "sha512-rvZUv+7MoBYTiDmFPBrhL7Ujx9Sk+q9wwm22x8c8T5IJaR+Wsyc7TNxbVxo84kZoRJZZMazowFLqpankBEQrGg==",
|
||||
"requires": {
|
||||
"tldts": "^6.1.32"
|
||||
}
|
||||
},
|
||||
"tr46": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/tr46/-/tr46-5.0.0.tgz",
|
||||
"integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==",
|
||||
"requires": {
|
||||
"punycode": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"w3c-xmlserializer": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
|
||||
"integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
|
||||
"requires": {
|
||||
"xml-name-validator": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
|
||||
},
|
||||
"whatwg-encoding": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
|
||||
"integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
|
||||
"requires": {
|
||||
"iconv-lite": "0.6.3"
|
||||
}
|
||||
},
|
||||
"whatwg-mimetype": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
|
||||
"integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg=="
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "14.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-14.1.0.tgz",
|
||||
"integrity": "sha512-jlf/foYIKywAt3x/XWKZ/3rz8OSJPiWktjmk891alJUEjiVxKX9LEO92qH3hv4aJ0mN3MWPvGMCy8jQi95xK4w==",
|
||||
"requires": {
|
||||
"tr46": "^5.0.0",
|
||||
"webidl-conversions": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.18.0",
|
||||
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz",
|
||||
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||
"requires": {}
|
||||
},
|
||||
"xml-name-validator": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
|
||||
"integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg=="
|
||||
},
|
||||
"xmlchars": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/xmlchars/-/xmlchars-2.2.0.tgz",
|
||||
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
8
jd_babel_channel/package.json
Normal file
8
jd_babel_channel/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.2.0",
|
||||
"deasync": "^0.1.30",
|
||||
"fingerprintjs2": "^2.1.4",
|
||||
"jsdom": "^26.0.0"
|
||||
}
|
||||
}
|
||||
11
jd_babel_channel/requirements.txt
Normal file
11
jd_babel_channel/requirements.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
flask==3.0.3
|
||||
flask_cors==4.0.1
|
||||
requests==2.32.3
|
||||
pyexecjs==1.5.1
|
||||
urllib3==1.26.2
|
||||
loguru==0.7.2
|
||||
pytz==2024.2
|
||||
opencv-python-headless==4.9.0.80
|
||||
pillow==10.3.0
|
||||
ddddocr==1.5.6
|
||||
numpy==1.26.4
|
||||
1110
jd_babel_channel/spider.py
Normal file
1110
jd_babel_channel/spider.py
Normal file
File diff suppressed because it is too large
Load Diff
8
jd_bind_card/.idea/.gitignore
generated
vendored
Normal file
8
jd_bind_card/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
14
jd_bind_card/.idea/deployment.xml
generated
Normal file
14
jd_bind_card/.idea/deployment.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData">
|
||||
<serverData>
|
||||
<paths name="root@120.24.83.163:22 password">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
</component>
|
||||
</project>
|
||||
23
jd_bind_card/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
23
jd_bind_card/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="9">
|
||||
<item index="0" class="java.lang.String" itemvalue="uwsgi" />
|
||||
<item index="1" class="java.lang.String" itemvalue="opencv-python" />
|
||||
<item index="2" class="java.lang.String" itemvalue="opencv-python-headless" />
|
||||
<item index="3" class="java.lang.String" itemvalue="pyexecjs" />
|
||||
<item index="4" class="java.lang.String" itemvalue="gevent" />
|
||||
<item index="5" class="java.lang.String" itemvalue="gunicorn" />
|
||||
<item index="6" class="java.lang.String" itemvalue="selenium" />
|
||||
<item index="7" class="java.lang.String" itemvalue="urllib3" />
|
||||
<item index="8" class="java.lang.String" itemvalue="redis" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
6
jd_bind_card/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
jd_bind_card/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
19
jd_bind_card/.idea/jd_bind_card.iml
generated
Normal file
19
jd_bind_card/.idea/jd_bind_card.iml
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="Flask">
|
||||
<option name="enabled" value="true" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/../jd_bind_card\templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
||||
7
jd_bind_card/.idea/misc.xml
generated
Normal file
7
jd_bind_card/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (jd_bind_card) (3)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
jd_bind_card/.idea/modules.xml
generated
Normal file
8
jd_bind_card/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/jd_bind_card.iml" filepath="$PROJECT_DIR$/.idea/jd_bind_card.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
jd_bind_card/.idea/vcs.xml
generated
Normal file
6
jd_bind_card/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
39
jd_bind_card/Dockerfile
Normal file
39
jd_bind_card/Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
# 基于 Python 3.9-slim 镜像
|
||||
FROM python:3.9-slim
|
||||
|
||||
# 修改apt-get源地址为阿里云镜像
|
||||
RUN echo "" > /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian buster main" >> /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >> /etc/apt/sources.list && \
|
||||
echo "deb http://mirrors.aliyun.com/debian buster-updates main" >> /etc/apt/sources.list
|
||||
|
||||
# 安装必要的工具和依赖
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
gnupg \
|
||||
libgl1-mesa-glx \
|
||||
libglib2.0-0 \
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 复制项目
|
||||
ADD . /app
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 暴露容器端口
|
||||
EXPOSE 5001
|
||||
|
||||
# 安装cv2依赖和其他依赖
|
||||
RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0
|
||||
|
||||
# python环境包
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
ENV FLASK_APP=app.py
|
||||
|
||||
# 运行应用
|
||||
CMD ["python", "app.py"]
|
||||
1
jd_bind_card/README.md
Normal file
1
jd_bind_card/README.md
Normal file
@@ -0,0 +1 @@
|
||||
docker run -e TZ=Asia/Shanghai --name jd_bind_card -p 8189:8189 -v /home/www/jd_bind_card:/app -d jd_bind_card
|
||||
BIN
jd_bind_card/__pycache__/app.cpython-38.pyc
Normal file
BIN
jd_bind_card/__pycache__/app.cpython-38.pyc
Normal file
Binary file not shown.
BIN
jd_bind_card/__pycache__/logger.cpython-38.pyc
Normal file
BIN
jd_bind_card/__pycache__/logger.cpython-38.pyc
Normal file
Binary file not shown.
BIN
jd_bind_card/__pycache__/spider.cpython-38.pyc
Normal file
BIN
jd_bind_card/__pycache__/spider.cpython-38.pyc
Normal file
Binary file not shown.
57
jd_bind_card/app.py
Normal file
57
jd_bind_card/app.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import json
|
||||
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
from logger import get_logger
|
||||
from spider import JdSpider, func
|
||||
|
||||
app = Flask(__name__)
|
||||
# 跨域
|
||||
CORS(app)
|
||||
# 日志
|
||||
logger = get_logger()
|
||||
|
||||
|
||||
@app.route('/jd/card/bind', methods=['GET', 'POST'], strict_slashes=False)
|
||||
def bind_card():
|
||||
if request.method == 'GET':
|
||||
return 'jd_card'
|
||||
elif request.method == 'POST':
|
||||
# 接收参数
|
||||
data = json.loads(request.get_data())
|
||||
card_pwd = data.get("card_pwd")
|
||||
order_num = data.get("order_num")
|
||||
cookies = data.get("cookies")
|
||||
# 打印参数日志
|
||||
logger.info(f"订单ID:{order_num},cookies:{cookies}")
|
||||
logger.info(f"订单ID:{order_num},card_pwd:{card_pwd}")
|
||||
res = JdSpider(
|
||||
card_pwd=card_pwd,
|
||||
order_num=order_num,
|
||||
cookies=cookies
|
||||
).run()
|
||||
logger.info(f"订单ID:{order_num},最终返回日志:{res}")
|
||||
# 打印响应日志
|
||||
return jsonify(res)
|
||||
|
||||
|
||||
@app.route("/jd/money/check", methods=["GET", "POST"])
|
||||
def money_check():
|
||||
if request.method == "GET":
|
||||
return "okk"
|
||||
elif request.method == "POST":
|
||||
# 接收参数
|
||||
data = json.loads(request.get_data())
|
||||
app.logger.info(f"接收到的请求数据: {data}")
|
||||
pool = ThreadPoolExecutor(50)
|
||||
# 提交任务并获取 Future 对象
|
||||
futures = [pool.submit(func, item) for item in data]
|
||||
# 收集结果
|
||||
results = [future.result() for future in as_completed(futures)]
|
||||
return jsonify(results)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="0.0.0.0", port=8189)
|
||||
19
jd_bind_card/gun.conf
Normal file
19
jd_bind_card/gun.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
# 并行工作进程数
|
||||
workers = 4
|
||||
# 指定每个工作者的线程数
|
||||
threads = 8
|
||||
# 监听内网端口80
|
||||
bind = '0.0.0.0:8189'
|
||||
# 工作模式协程
|
||||
worker_class = 'gevent'
|
||||
# 设置最大并发量
|
||||
worker_connections = 2000
|
||||
# 设置进程文件目录
|
||||
pidfile = 'gunicorn.pid'
|
||||
# 设置访问日志和错误信息日志路径
|
||||
accesslog = '-'
|
||||
errorlog = '-'
|
||||
# 设置日志记录水平
|
||||
loglevel = 'info'
|
||||
# 代码发生变化是否自动重启
|
||||
reload = True
|
||||
13830
jd_bind_card/js/captcha_m.js
Normal file
13830
jd_bind_card/js/captcha_m.js
Normal file
File diff suppressed because one or more lines are too long
14
jd_bind_card/js/decrypt_des.js
Normal file
14
jd_bind_card/js/decrypt_des.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const CryptoJS = require("crypto-js");
|
||||
|
||||
function decryptDes(message, key) {
|
||||
const _key = CryptoJS.enc.Utf8.parse(key);
|
||||
const decrypt = CryptoJS.DES.decrypt(message, _key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
|
||||
}
|
||||
|
||||
|
||||
const res = decryptDes("BsBfLCzOTlBGoq5gIBRaut/J4HS04QS9xK893Q3Ic4IJIyRuRlJdme+hHfZ9QE/4KEIqm0AGMw2fMg7uCw0dkVxQ2VF287irFgf1hfDcjLBlqx3jlqZ+ppGA/LSZ8fD89OtWnpDhel352bQn77KOQk2ysxtQjCRPdmmW2vs0gSHmHP7zg4UNuFeUMylDQ6Fe", "2E1ZMAF88CCE5EBE551FR3E9AA6FF322")
|
||||
console.log(res)
|
||||
29
jd_bind_card/logger.py
Normal file
29
jd_bind_card/logger.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from loguru import logger
|
||||
import sys
|
||||
import pytz
|
||||
from datetime import datetime
|
||||
|
||||
# 移除默认的日志处理器
|
||||
logger.remove()
|
||||
|
||||
# 设置中国时区
|
||||
china_tz = pytz.timezone("Asia/Shanghai")
|
||||
|
||||
|
||||
# 自定义时间格式函数
|
||||
def custom_time():
|
||||
return datetime.now(china_tz).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
# 添加新的处理器,输出到控制台
|
||||
logger.add(sys.stdout, format="{time:YYYY-MM-DD HH:mm:ss} {level} {message}", level="INFO", serialize=False)
|
||||
|
||||
# 添加文件日志处理器
|
||||
logger.add("giftcard.log", rotation="20 MB", retention="30 days", format="{time:YYYY-MM-DD HH:mm:ss} {level} {message}")
|
||||
|
||||
# 创建一个带有时间信息的 Logger
|
||||
logger = logger.bind(time=custom_time())
|
||||
|
||||
|
||||
def get_logger():
|
||||
return logger
|
||||
43
jd_bind_card/node_modules/.package-lock.json
generated
vendored
Normal file
43
jd_bind_card/node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "jd_bind_card",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"dependencies": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/crypto-js": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||
},
|
||||
"node_modules/deasync": {
|
||||
"version": "0.1.30",
|
||||
"resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.30.tgz",
|
||||
"integrity": "sha512-OaAjvEQuQ9tJsKG4oHO9nV1UHTwb2Qc2+fadB0VeVtD0Z9wiG1XPGLJ4W3aLhAoQSYTaLROFRbd5X20Dkzf7MQ==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
"node-addon-api": "^1.7.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"node_modules/node-addon-api": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
22
jd_bind_card/node_modules/bindings/LICENSE.md
generated
vendored
Normal file
22
jd_bind_card/node_modules/bindings/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
98
jd_bind_card/node_modules/bindings/README.md
generated
vendored
Normal file
98
jd_bind_card/node_modules/bindings/README.md
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
node-bindings
|
||||
=============
|
||||
### Helper module for loading your native module's `.node` file
|
||||
|
||||
This is a helper module for authors of Node.js native addon modules.
|
||||
It is basically the "swiss army knife" of `require()`ing your native module's
|
||||
`.node` file.
|
||||
|
||||
Throughout the course of Node's native addon history, addons have ended up being
|
||||
compiled in a variety of different places, depending on which build tool and which
|
||||
version of node was used. To make matters worse, now the `gyp` build tool can
|
||||
produce either a __Release__ or __Debug__ build, each being built into different
|
||||
locations.
|
||||
|
||||
This module checks _all_ the possible locations that a native addon would be built
|
||||
at, and returns the first one that loads successfully.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install --save bindings
|
||||
```
|
||||
|
||||
Or add it to the `"dependencies"` section of your `package.json` file.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
`require()`ing the proper bindings file for the current node version, platform
|
||||
and architecture is as simple as:
|
||||
|
||||
``` js
|
||||
var bindings = require('bindings')('binding.node')
|
||||
|
||||
// Use your bindings defined in your C files
|
||||
bindings.your_c_function()
|
||||
```
|
||||
|
||||
|
||||
Nice Error Output
|
||||
-----------------
|
||||
|
||||
When the `.node` file could not be loaded, `node-bindings` throws an Error with
|
||||
a nice error message telling you exactly what was tried. You can also check the
|
||||
`err.tries` Array property.
|
||||
|
||||
```
|
||||
Error: Could not load the bindings file. Tried:
|
||||
→ /Users/nrajlich/ref/build/binding.node
|
||||
→ /Users/nrajlich/ref/build/Debug/binding.node
|
||||
→ /Users/nrajlich/ref/build/Release/binding.node
|
||||
→ /Users/nrajlich/ref/out/Debug/binding.node
|
||||
→ /Users/nrajlich/ref/Debug/binding.node
|
||||
→ /Users/nrajlich/ref/out/Release/binding.node
|
||||
→ /Users/nrajlich/ref/Release/binding.node
|
||||
→ /Users/nrajlich/ref/build/default/binding.node
|
||||
→ /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node
|
||||
at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13)
|
||||
at Object.<anonymous> (/Users/nrajlich/ref/lib/ref.js:5:47)
|
||||
at Module._compile (module.js:449:26)
|
||||
at Object.Module._extensions..js (module.js:467:10)
|
||||
at Module.load (module.js:356:32)
|
||||
at Function.Module._load (module.js:312:12)
|
||||
...
|
||||
```
|
||||
|
||||
The searching for the `.node` file will originate from the first directory in which has a `package.json` file is found.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
221
jd_bind_card/node_modules/bindings/bindings.js
generated
vendored
Normal file
221
jd_bind_card/node_modules/bindings/bindings.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
fileURLToPath = require('file-uri-to-path'),
|
||||
join = path.join,
|
||||
dirname = path.dirname,
|
||||
exists =
|
||||
(fs.accessSync &&
|
||||
function(path) {
|
||||
try {
|
||||
fs.accessSync(path);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}) ||
|
||||
fs.existsSync ||
|
||||
path.existsSync,
|
||||
defaults = {
|
||||
arrow: process.env.NODE_BINDINGS_ARROW || ' → ',
|
||||
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled',
|
||||
platform: process.platform,
|
||||
arch: process.arch,
|
||||
nodePreGyp:
|
||||
'node-v' +
|
||||
process.versions.modules +
|
||||
'-' +
|
||||
process.platform +
|
||||
'-' +
|
||||
process.arch,
|
||||
version: process.versions.node,
|
||||
bindings: 'bindings.node',
|
||||
try: [
|
||||
// node-gyp's linked version in the "build" dir
|
||||
['module_root', 'build', 'bindings'],
|
||||
// node-waf and gyp_addon (a.k.a node-gyp)
|
||||
['module_root', 'build', 'Debug', 'bindings'],
|
||||
['module_root', 'build', 'Release', 'bindings'],
|
||||
// Debug files, for development (legacy behavior, remove for node v0.9)
|
||||
['module_root', 'out', 'Debug', 'bindings'],
|
||||
['module_root', 'Debug', 'bindings'],
|
||||
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
||||
['module_root', 'out', 'Release', 'bindings'],
|
||||
['module_root', 'Release', 'bindings'],
|
||||
// Legacy from node-waf, node <= 0.4.x
|
||||
['module_root', 'build', 'default', 'bindings'],
|
||||
// Production "Release" buildtype binary (meh...)
|
||||
['module_root', 'compiled', 'version', 'platform', 'arch', 'bindings'],
|
||||
// node-qbs builds
|
||||
['module_root', 'addon-build', 'release', 'install-root', 'bindings'],
|
||||
['module_root', 'addon-build', 'debug', 'install-root', 'bindings'],
|
||||
['module_root', 'addon-build', 'default', 'install-root', 'bindings'],
|
||||
// node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch}
|
||||
['module_root', 'lib', 'binding', 'nodePreGyp', 'bindings']
|
||||
]
|
||||
};
|
||||
|
||||
/**
|
||||
* The main `bindings()` function loads the compiled bindings for a given module.
|
||||
* It uses V8's Error API to determine the parent filename that this function is
|
||||
* being invoked from, which is then used to find the root directory.
|
||||
*/
|
||||
|
||||
function bindings(opts) {
|
||||
// Argument surgery
|
||||
if (typeof opts == 'string') {
|
||||
opts = { bindings: opts };
|
||||
} else if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
// maps `defaults` onto `opts` object
|
||||
Object.keys(defaults).map(function(i) {
|
||||
if (!(i in opts)) opts[i] = defaults[i];
|
||||
});
|
||||
|
||||
// Get the module root
|
||||
if (!opts.module_root) {
|
||||
opts.module_root = exports.getRoot(exports.getFileName());
|
||||
}
|
||||
|
||||
// Ensure the given bindings name ends with .node
|
||||
if (path.extname(opts.bindings) != '.node') {
|
||||
opts.bindings += '.node';
|
||||
}
|
||||
|
||||
// https://github.com/webpack/webpack/issues/4175#issuecomment-342931035
|
||||
var requireFunc =
|
||||
typeof __webpack_require__ === 'function'
|
||||
? __non_webpack_require__
|
||||
: require;
|
||||
|
||||
var tries = [],
|
||||
i = 0,
|
||||
l = opts.try.length,
|
||||
n,
|
||||
b,
|
||||
err;
|
||||
|
||||
for (; i < l; i++) {
|
||||
n = join.apply(
|
||||
null,
|
||||
opts.try[i].map(function(p) {
|
||||
return opts[p] || p;
|
||||
})
|
||||
);
|
||||
tries.push(n);
|
||||
try {
|
||||
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
||||
if (!opts.path) {
|
||||
b.path = n;
|
||||
}
|
||||
return b;
|
||||
} catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND' &&
|
||||
e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED' &&
|
||||
!/not find/i.test(e.message)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = new Error(
|
||||
'Could not locate the bindings file. Tried:\n' +
|
||||
tries
|
||||
.map(function(a) {
|
||||
return opts.arrow + a;
|
||||
})
|
||||
.join('\n')
|
||||
);
|
||||
err.tries = tries;
|
||||
throw err;
|
||||
}
|
||||
module.exports = exports = bindings;
|
||||
|
||||
/**
|
||||
* Gets the filename of the JavaScript file that invokes this function.
|
||||
* Used to help find the root directory of a module.
|
||||
* Optionally accepts an filename argument to skip when searching for the invoking filename
|
||||
*/
|
||||
|
||||
exports.getFileName = function getFileName(calling_file) {
|
||||
var origPST = Error.prepareStackTrace,
|
||||
origSTL = Error.stackTraceLimit,
|
||||
dummy = {},
|
||||
fileName;
|
||||
|
||||
Error.stackTraceLimit = 10;
|
||||
|
||||
Error.prepareStackTrace = function(e, st) {
|
||||
for (var i = 0, l = st.length; i < l; i++) {
|
||||
fileName = st[i].getFileName();
|
||||
if (fileName !== __filename) {
|
||||
if (calling_file) {
|
||||
if (fileName !== calling_file) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// run the 'prepareStackTrace' function above
|
||||
Error.captureStackTrace(dummy);
|
||||
dummy.stack;
|
||||
|
||||
// cleanup
|
||||
Error.prepareStackTrace = origPST;
|
||||
Error.stackTraceLimit = origSTL;
|
||||
|
||||
// handle filename that starts with "file://"
|
||||
var fileSchema = 'file://';
|
||||
if (fileName.indexOf(fileSchema) === 0) {
|
||||
fileName = fileURLToPath(fileName);
|
||||
}
|
||||
|
||||
return fileName;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the root directory of a module, given an arbitrary filename
|
||||
* somewhere in the module tree. The "root directory" is the directory
|
||||
* containing the `package.json` file.
|
||||
*
|
||||
* In: /home/nate/node-native-module/lib/index.js
|
||||
* Out: /home/nate/node-native-module
|
||||
*/
|
||||
|
||||
exports.getRoot = function getRoot(file) {
|
||||
var dir = dirname(file),
|
||||
prev;
|
||||
while (true) {
|
||||
if (dir === '.') {
|
||||
// Avoids an infinite loop in rare cases, like the REPL
|
||||
dir = process.cwd();
|
||||
}
|
||||
if (
|
||||
exists(join(dir, 'package.json')) ||
|
||||
exists(join(dir, 'node_modules'))
|
||||
) {
|
||||
// Found the 'package.json' file or 'node_modules' dir; we're done
|
||||
return dir;
|
||||
}
|
||||
if (prev === dir) {
|
||||
// Got to the top
|
||||
throw new Error(
|
||||
'Could not find module root given file: "' +
|
||||
file +
|
||||
'". Do you have a `package.json` file? '
|
||||
);
|
||||
}
|
||||
// Try the parent dir next
|
||||
prev = dir;
|
||||
dir = join(dir, '..');
|
||||
}
|
||||
};
|
||||
28
jd_bind_card/node_modules/bindings/package.json
generated
vendored
Normal file
28
jd_bind_card/node_modules/bindings/package.json
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "bindings",
|
||||
"description": "Helper module for loading your native module's .node file",
|
||||
"keywords": [
|
||||
"native",
|
||||
"addon",
|
||||
"bindings",
|
||||
"gyp",
|
||||
"waf",
|
||||
"c",
|
||||
"c++"
|
||||
],
|
||||
"version": "1.5.0",
|
||||
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/node-bindings.git"
|
||||
},
|
||||
"main": "./bindings.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/node-bindings/issues"
|
||||
},
|
||||
"homepage": "https://github.com/TooTallNate/node-bindings",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
}
|
||||
28
jd_bind_card/node_modules/crypto-js/CONTRIBUTING.md
generated
vendored
Normal file
28
jd_bind_card/node_modules/crypto-js/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Contribution
|
||||
|
||||
# Git Flow
|
||||
|
||||
The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches.
|
||||
Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch.
|
||||
|
||||
# Pull request
|
||||
|
||||
Target your pull request on `develop` branch. Other pull request won't be accepted.
|
||||
|
||||
# How to build
|
||||
|
||||
1. Clone
|
||||
|
||||
2. Run
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
3. Run
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
4. Check `build` folder
|
||||
24
jd_bind_card/node_modules/crypto-js/LICENSE
generated
vendored
Normal file
24
jd_bind_card/node_modules/crypto-js/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# License
|
||||
|
||||
[The MIT License (MIT)](http://opensource.org/licenses/MIT)
|
||||
|
||||
Copyright (c) 2009-2013 Jeff Mott
|
||||
Copyright (c) 2013-2016 Evan Vosberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
275
jd_bind_card/node_modules/crypto-js/README.md
generated
vendored
Normal file
275
jd_bind_card/node_modules/crypto-js/README.md
generated
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
# crypto-js
|
||||
|
||||
JavaScript library of crypto standards.
|
||||
|
||||
## Discontinued
|
||||
|
||||
Active development of CryptoJS has been discontinued. This library is no longer maintained.
|
||||
|
||||
Nowadays, NodeJS and modern browsers have a native `Crypto` module. The latest version of CryptoJS already uses the native Crypto module for random number generation, since `Math.random()` is not crypto-safe. Further development of CryptoJS would result in it only being a wrapper of native Crypto. Therefore, development and maintenance has been discontinued, it is time to go for the native `crypto` module.
|
||||
|
||||
## Node.js (Install)
|
||||
|
||||
Requirements:
|
||||
|
||||
- Node.js
|
||||
- npm (Node.js package manager)
|
||||
|
||||
```bash
|
||||
npm install crypto-js
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
ES6 import for typical API call signing use case:
|
||||
|
||||
```javascript
|
||||
import sha256 from 'crypto-js/sha256';
|
||||
import hmacSHA512 from 'crypto-js/hmac-sha512';
|
||||
import Base64 from 'crypto-js/enc-base64';
|
||||
|
||||
const message, nonce, path, privateKey; // ...
|
||||
const hashDigest = sha256(nonce + message);
|
||||
const hmacDigest = Base64.stringify(hmacSHA512(path + hashDigest, privateKey));
|
||||
```
|
||||
|
||||
Modular include:
|
||||
|
||||
```javascript
|
||||
var AES = require("crypto-js/aes");
|
||||
var SHA256 = require("crypto-js/sha256");
|
||||
...
|
||||
console.log(SHA256("Message"));
|
||||
```
|
||||
|
||||
Including all libraries, for access to extra methods:
|
||||
|
||||
```javascript
|
||||
var CryptoJS = require("crypto-js");
|
||||
console.log(CryptoJS.HmacSHA1("Message", "Key"));
|
||||
```
|
||||
|
||||
## Client (browser)
|
||||
|
||||
Requirements:
|
||||
|
||||
- Node.js
|
||||
- Bower (package manager for frontend)
|
||||
|
||||
```bash
|
||||
bower install crypto-js
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Modular include:
|
||||
|
||||
```javascript
|
||||
require.config({
|
||||
packages: [
|
||||
{
|
||||
name: 'crypto-js',
|
||||
location: 'path-to/bower_components/crypto-js',
|
||||
main: 'index'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) {
|
||||
console.log(SHA256("Message"));
|
||||
});
|
||||
```
|
||||
|
||||
Including all libraries, for access to extra methods:
|
||||
|
||||
```javascript
|
||||
// Above-mentioned will work or use this simple form
|
||||
require.config({
|
||||
paths: {
|
||||
'crypto-js': 'path-to/bower_components/crypto-js/crypto-js'
|
||||
}
|
||||
});
|
||||
|
||||
require(["crypto-js"], function (CryptoJS) {
|
||||
console.log(CryptoJS.HmacSHA1("Message", "Key"));
|
||||
});
|
||||
```
|
||||
|
||||
### Usage without RequireJS
|
||||
|
||||
```html
|
||||
<script type="text/javascript" src="path-to/bower_components/crypto-js/crypto-js.js"></script>
|
||||
<script type="text/javascript">
|
||||
var encrypted = CryptoJS.AES(...);
|
||||
var encrypted = CryptoJS.SHA256(...);
|
||||
</script>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
See: https://cryptojs.gitbook.io/docs/
|
||||
|
||||
### AES Encryption
|
||||
|
||||
#### Plain text encryption
|
||||
|
||||
```javascript
|
||||
var CryptoJS = require("crypto-js");
|
||||
|
||||
// Encrypt
|
||||
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString();
|
||||
|
||||
// Decrypt
|
||||
var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
|
||||
var originalText = bytes.toString(CryptoJS.enc.Utf8);
|
||||
|
||||
console.log(originalText); // 'my message'
|
||||
```
|
||||
|
||||
#### Object encryption
|
||||
|
||||
```javascript
|
||||
var CryptoJS = require("crypto-js");
|
||||
|
||||
var data = [{id: 1}, {id: 2}]
|
||||
|
||||
// Encrypt
|
||||
var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString();
|
||||
|
||||
// Decrypt
|
||||
var bytes = CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
|
||||
var decryptedData = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
|
||||
|
||||
console.log(decryptedData); // [{id: 1}, {id: 2}]
|
||||
```
|
||||
|
||||
### List of modules
|
||||
|
||||
|
||||
- ```crypto-js/core```
|
||||
- ```crypto-js/x64-core```
|
||||
- ```crypto-js/lib-typedarrays```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/md5```
|
||||
- ```crypto-js/sha1```
|
||||
- ```crypto-js/sha256```
|
||||
- ```crypto-js/sha224```
|
||||
- ```crypto-js/sha512```
|
||||
- ```crypto-js/sha384```
|
||||
- ```crypto-js/sha3```
|
||||
- ```crypto-js/ripemd160```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/hmac-md5```
|
||||
- ```crypto-js/hmac-sha1```
|
||||
- ```crypto-js/hmac-sha256```
|
||||
- ```crypto-js/hmac-sha224```
|
||||
- ```crypto-js/hmac-sha512```
|
||||
- ```crypto-js/hmac-sha384```
|
||||
- ```crypto-js/hmac-sha3```
|
||||
- ```crypto-js/hmac-ripemd160```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/pbkdf2```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/aes```
|
||||
- ```crypto-js/tripledes```
|
||||
- ```crypto-js/rc4```
|
||||
- ```crypto-js/rabbit```
|
||||
- ```crypto-js/rabbit-legacy```
|
||||
- ```crypto-js/evpkdf```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/format-openssl```
|
||||
- ```crypto-js/format-hex```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/enc-latin1```
|
||||
- ```crypto-js/enc-utf8```
|
||||
- ```crypto-js/enc-hex```
|
||||
- ```crypto-js/enc-utf16```
|
||||
- ```crypto-js/enc-base64```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/mode-cfb```
|
||||
- ```crypto-js/mode-ctr```
|
||||
- ```crypto-js/mode-ctr-gladman```
|
||||
- ```crypto-js/mode-ofb```
|
||||
- ```crypto-js/mode-ecb```
|
||||
|
||||
---
|
||||
|
||||
- ```crypto-js/pad-pkcs7```
|
||||
- ```crypto-js/pad-ansix923```
|
||||
- ```crypto-js/pad-iso10126```
|
||||
- ```crypto-js/pad-iso97971```
|
||||
- ```crypto-js/pad-zeropadding```
|
||||
- ```crypto-js/pad-nopadding```
|
||||
|
||||
|
||||
## Release notes
|
||||
|
||||
### 4.2.0
|
||||
|
||||
Change default hash algorithm and iteration's for PBKDF2 to prevent weak security by using the default configuration.
|
||||
|
||||
Custom KDF Hasher
|
||||
|
||||
Blowfish support
|
||||
|
||||
### 4.1.1
|
||||
|
||||
Fix module order in bundled release.
|
||||
|
||||
Include the browser field in the released package.json.
|
||||
|
||||
### 4.1.0
|
||||
|
||||
Added url safe variant of base64 encoding. [357](https://github.com/brix/crypto-js/pull/357)
|
||||
|
||||
Avoid webpack to add crypto-browser package. [364](https://github.com/brix/crypto-js/pull/364)
|
||||
|
||||
### 4.0.0
|
||||
|
||||
This is an update including breaking changes for some environments.
|
||||
|
||||
In this version `Math.random()` has been replaced by the random methods of the native crypto module.
|
||||
|
||||
For this reason CryptoJS might not run in some JavaScript environments without native crypto module. Such as IE 10 or before or React Native.
|
||||
|
||||
### 3.3.0
|
||||
|
||||
Rollback, `3.3.0` is the same as `3.1.9-1`.
|
||||
|
||||
The move of using native secure crypto module will be shifted to a new `4.x.x` version. As it is a breaking change the impact is too big for a minor release.
|
||||
|
||||
### 3.2.1
|
||||
|
||||
The usage of the native crypto module has been fixed. The import and access of the native crypto module has been improved.
|
||||
|
||||
### 3.2.0
|
||||
|
||||
In this version `Math.random()` has been replaced by the random methods of the native crypto module.
|
||||
|
||||
For this reason CryptoJS might does not run in some JavaScript environments without native crypto module. Such as IE 10 or before.
|
||||
|
||||
If it's absolute required to run CryptoJS in such an environment, stay with `3.1.x` version. Encrypting and decrypting stays compatible. But keep in mind `3.1.x` versions still use `Math.random()` which is cryptographically not secure, as it's not random enough.
|
||||
|
||||
This version came along with `CRITICAL` `BUG`.
|
||||
|
||||
DO NOT USE THIS VERSION! Please, go for a newer version!
|
||||
|
||||
### 3.1.x
|
||||
|
||||
The `3.1.x` are based on the original CryptoJS, wrapped in CommonJS modules.
|
||||
|
||||
|
||||
234
jd_bind_card/node_modules/crypto-js/aes.js
generated
vendored
Normal file
234
jd_bind_card/node_modules/crypto-js/aes.js
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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);
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.AES;
|
||||
|
||||
}));
|
||||
471
jd_bind_card/node_modules/crypto-js/blowfish.js
generated
vendored
Normal file
471
jd_bind_card/node_modules/crypto-js/blowfish.js
generated
vendored
Normal file
@@ -0,0 +1,471 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(function () {
|
||||
// Shortcuts
|
||||
var C = CryptoJS;
|
||||
var C_lib = C.lib;
|
||||
var BlockCipher = C_lib.BlockCipher;
|
||||
var C_algo = C.algo;
|
||||
|
||||
const N = 16;
|
||||
|
||||
//Origin pbox and sbox, derived from PI
|
||||
const ORIG_P = [
|
||||
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
|
||||
0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
|
||||
0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
|
||||
0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
|
||||
0x9216D5D9, 0x8979FB1B
|
||||
];
|
||||
|
||||
const ORIG_S = [
|
||||
[ 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
|
||||
0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
|
||||
0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
|
||||
0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
|
||||
0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
|
||||
0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
|
||||
0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
|
||||
0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
|
||||
0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
|
||||
0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
|
||||
0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
|
||||
0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
|
||||
0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
|
||||
0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
|
||||
0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
|
||||
0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
|
||||
0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
|
||||
0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
|
||||
0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
|
||||
0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
|
||||
0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
|
||||
0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
|
||||
0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
|
||||
0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
|
||||
0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
|
||||
0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
|
||||
0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
|
||||
0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
|
||||
0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
|
||||
0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
|
||||
0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
|
||||
0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
|
||||
0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
|
||||
0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
|
||||
0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
|
||||
0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
|
||||
0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
|
||||
0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
|
||||
0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
|
||||
0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
|
||||
0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
|
||||
0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
|
||||
0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
|
||||
0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
|
||||
0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
|
||||
0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
|
||||
0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
|
||||
0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
|
||||
0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
|
||||
0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
|
||||
0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
|
||||
0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
|
||||
0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
|
||||
0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
|
||||
0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
|
||||
0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
|
||||
0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
|
||||
0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
|
||||
0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
|
||||
0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
|
||||
0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
|
||||
0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
|
||||
0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
|
||||
0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A ],
|
||||
[ 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
|
||||
0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
|
||||
0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
|
||||
0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
|
||||
0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
|
||||
0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
|
||||
0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
|
||||
0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
|
||||
0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
|
||||
0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
|
||||
0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
|
||||
0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
|
||||
0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
|
||||
0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
|
||||
0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
|
||||
0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
|
||||
0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
|
||||
0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
|
||||
0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
|
||||
0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
|
||||
0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
|
||||
0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
|
||||
0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
|
||||
0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
|
||||
0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
|
||||
0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
|
||||
0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
|
||||
0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
|
||||
0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
|
||||
0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
|
||||
0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
|
||||
0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
|
||||
0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
|
||||
0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
|
||||
0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
|
||||
0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
|
||||
0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
|
||||
0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
|
||||
0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
|
||||
0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
|
||||
0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
|
||||
0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
|
||||
0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
|
||||
0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
|
||||
0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
|
||||
0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
|
||||
0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
|
||||
0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
|
||||
0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
|
||||
0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
|
||||
0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
|
||||
0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
|
||||
0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
|
||||
0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
|
||||
0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
|
||||
0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
|
||||
0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
|
||||
0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
|
||||
0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
|
||||
0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
|
||||
0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
|
||||
0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
|
||||
0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
|
||||
0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7 ],
|
||||
[ 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
|
||||
0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
|
||||
0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
|
||||
0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
|
||||
0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
|
||||
0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
|
||||
0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
|
||||
0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
|
||||
0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
|
||||
0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
|
||||
0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
|
||||
0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
|
||||
0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
|
||||
0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
|
||||
0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
|
||||
0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
|
||||
0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
|
||||
0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
|
||||
0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
|
||||
0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
|
||||
0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
|
||||
0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
|
||||
0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
|
||||
0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
|
||||
0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
|
||||
0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
|
||||
0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
|
||||
0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
|
||||
0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
|
||||
0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
|
||||
0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
|
||||
0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
|
||||
0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
|
||||
0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
|
||||
0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
|
||||
0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
|
||||
0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
|
||||
0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
|
||||
0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
|
||||
0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
|
||||
0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
|
||||
0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
|
||||
0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
|
||||
0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
|
||||
0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
|
||||
0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
|
||||
0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
|
||||
0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
|
||||
0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
|
||||
0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
|
||||
0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
|
||||
0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
|
||||
0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
|
||||
0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
|
||||
0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
|
||||
0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
|
||||
0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
|
||||
0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
|
||||
0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
|
||||
0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
|
||||
0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
|
||||
0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
|
||||
0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
|
||||
0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0 ],
|
||||
[ 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
|
||||
0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
|
||||
0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
|
||||
0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
|
||||
0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
|
||||
0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
|
||||
0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
|
||||
0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
|
||||
0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
|
||||
0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
|
||||
0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
|
||||
0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
|
||||
0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
|
||||
0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
|
||||
0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
|
||||
0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
|
||||
0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
|
||||
0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
|
||||
0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
|
||||
0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
|
||||
0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
|
||||
0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
|
||||
0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
|
||||
0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
|
||||
0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
|
||||
0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
|
||||
0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
|
||||
0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
|
||||
0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
|
||||
0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
|
||||
0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
|
||||
0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
|
||||
0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
|
||||
0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
|
||||
0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
|
||||
0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
|
||||
0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
|
||||
0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
|
||||
0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
|
||||
0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
|
||||
0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
|
||||
0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
|
||||
0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
|
||||
0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
|
||||
0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
|
||||
0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
|
||||
0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
|
||||
0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
|
||||
0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
|
||||
0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
|
||||
0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
|
||||
0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
|
||||
0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
|
||||
0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
|
||||
0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
|
||||
0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
|
||||
0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
|
||||
0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
|
||||
0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
|
||||
0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
|
||||
0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
|
||||
0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
|
||||
0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
|
||||
0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6 ]
|
||||
];
|
||||
|
||||
var BLOWFISH_CTX = {
|
||||
pbox: [],
|
||||
sbox: []
|
||||
}
|
||||
|
||||
function F(ctx, x){
|
||||
let a = (x >> 24) & 0xFF;
|
||||
let b = (x >> 16) & 0xFF;
|
||||
let c = (x >> 8) & 0xFF;
|
||||
let d = x & 0xFF;
|
||||
|
||||
let y = ctx.sbox[0][a] + ctx.sbox[1][b];
|
||||
y = y ^ ctx.sbox[2][c];
|
||||
y = y + ctx.sbox[3][d];
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
function BlowFish_Encrypt(ctx, left, right){
|
||||
let Xl = left;
|
||||
let Xr = right;
|
||||
let temp;
|
||||
|
||||
for(let i = 0; i < N; ++i){
|
||||
Xl = Xl ^ ctx.pbox[i];
|
||||
Xr = F(ctx, Xl) ^ Xr;
|
||||
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
}
|
||||
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
|
||||
Xr = Xr ^ ctx.pbox[N];
|
||||
Xl = Xl ^ ctx.pbox[N + 1];
|
||||
|
||||
return {left: Xl, right: Xr};
|
||||
}
|
||||
|
||||
function BlowFish_Decrypt(ctx, left, right){
|
||||
let Xl = left;
|
||||
let Xr = right;
|
||||
let temp;
|
||||
|
||||
for(let i = N + 1; i > 1; --i){
|
||||
Xl = Xl ^ ctx.pbox[i];
|
||||
Xr = F(ctx, Xl) ^ Xr;
|
||||
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
}
|
||||
|
||||
temp = Xl;
|
||||
Xl = Xr;
|
||||
Xr = temp;
|
||||
|
||||
Xr = Xr ^ ctx.pbox[1];
|
||||
Xl = Xl ^ ctx.pbox[0];
|
||||
|
||||
return {left: Xl, right: Xr};
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization ctx's pbox and sbox.
|
||||
*
|
||||
* @param {Object} ctx The object has pbox and sbox.
|
||||
* @param {Array} key An array of 32-bit words.
|
||||
* @param {int} keysize The length of the key.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* BlowFishInit(BLOWFISH_CTX, key, 128/32);
|
||||
*/
|
||||
function BlowFishInit(ctx, key, keysize)
|
||||
{
|
||||
for(let Row = 0; Row < 4; Row++)
|
||||
{
|
||||
ctx.sbox[Row] = [];
|
||||
for(let Col = 0; Col < 256; Col++)
|
||||
{
|
||||
ctx.sbox[Row][Col] = ORIG_S[Row][Col];
|
||||
}
|
||||
}
|
||||
|
||||
let keyIndex = 0;
|
||||
for(let index = 0; index < N + 2; index++)
|
||||
{
|
||||
ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex];
|
||||
keyIndex++;
|
||||
if(keyIndex >= keysize)
|
||||
{
|
||||
keyIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
let Data1 = 0;
|
||||
let Data2 = 0;
|
||||
let res = 0;
|
||||
for(let i = 0; i < N + 2; i += 2)
|
||||
{
|
||||
res = BlowFish_Encrypt(ctx, Data1, Data2);
|
||||
Data1 = res.left;
|
||||
Data2 = res.right;
|
||||
ctx.pbox[i] = Data1;
|
||||
ctx.pbox[i + 1] = Data2;
|
||||
}
|
||||
|
||||
for(let i = 0; i < 4; i++)
|
||||
{
|
||||
for(let j = 0; j < 256; j += 2)
|
||||
{
|
||||
res = BlowFish_Encrypt(ctx, Data1, Data2);
|
||||
Data1 = res.left;
|
||||
Data2 = res.right;
|
||||
ctx.sbox[i][j] = Data1;
|
||||
ctx.sbox[i][j + 1] = Data2;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blowfish block cipher algorithm.
|
||||
*/
|
||||
var Blowfish = C_algo.Blowfish = BlockCipher.extend({
|
||||
_doReset: function () {
|
||||
// Skip reset of nRounds has been set before and key did not change
|
||||
if (this._keyPriorReset === this._key) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Shortcuts
|
||||
var key = this._keyPriorReset = this._key;
|
||||
var keyWords = key.words;
|
||||
var keySize = key.sigBytes / 4;
|
||||
|
||||
//Initialization pbox and sbox
|
||||
BlowFishInit(BLOWFISH_CTX, keyWords, keySize);
|
||||
},
|
||||
|
||||
encryptBlock: function (M, offset) {
|
||||
var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
|
||||
M[offset] = res.left;
|
||||
M[offset + 1] = res.right;
|
||||
},
|
||||
|
||||
decryptBlock: function (M, offset) {
|
||||
var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
|
||||
M[offset] = res.left;
|
||||
M[offset + 1] = res.right;
|
||||
},
|
||||
|
||||
blockSize: 64/32,
|
||||
|
||||
keySize: 128/32,
|
||||
|
||||
ivSize: 64/32
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcut functions to the cipher's object interface.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg);
|
||||
* var plaintext = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);
|
||||
*/
|
||||
C.Blowfish = BlockCipher._createHelper(Blowfish);
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.Blowfish;
|
||||
|
||||
}));
|
||||
39
jd_bind_card/node_modules/crypto-js/bower.json
generated
vendored
Normal file
39
jd_bind_card/node_modules/crypto-js/bower.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "crypto-js",
|
||||
"version": "4.2.0",
|
||||
"description": "JavaScript library of crypto standards.",
|
||||
"license": "MIT",
|
||||
"homepage": "http://github.com/brix/crypto-js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/brix/crypto-js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"security",
|
||||
"crypto",
|
||||
"Hash",
|
||||
"MD5",
|
||||
"SHA1",
|
||||
"SHA-1",
|
||||
"SHA256",
|
||||
"SHA-256",
|
||||
"RC4",
|
||||
"Rabbit",
|
||||
"AES",
|
||||
"DES",
|
||||
"PBKDF2",
|
||||
"HMAC",
|
||||
"OFB",
|
||||
"CFB",
|
||||
"CTR",
|
||||
"CBC",
|
||||
"Base64",
|
||||
"Base64url"
|
||||
],
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"browser": {
|
||||
"crypto": false
|
||||
},
|
||||
"ignore": []
|
||||
}
|
||||
895
jd_bind_card/node_modules/crypto-js/cipher-core.js
generated
vendored
Normal file
895
jd_bind_card/node_modules/crypto-js/cipher-core.js
generated
vendored
Normal file
@@ -0,0 +1,895 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./evpkdf"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./evpkdf"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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, hasher) {
|
||||
// Generate random salt
|
||||
if (!salt) {
|
||||
salt = WordArray.random(64/8);
|
||||
}
|
||||
|
||||
// Derive key and IV
|
||||
if (!hasher) {
|
||||
var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
||||
} else {
|
||||
var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).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, cfg.salt, cfg.hasher);
|
||||
|
||||
// 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, cfg.hasher);
|
||||
|
||||
// Add IV to config
|
||||
cfg.iv = derivedParams.iv;
|
||||
|
||||
// Decrypt
|
||||
var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
|
||||
|
||||
return plaintext;
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
|
||||
}));
|
||||
807
jd_bind_card/node_modules/crypto-js/core.js
generated
vendored
Normal file
807
jd_bind_card/node_modules/crypto-js/core.js
generated
vendored
Normal file
@@ -0,0 +1,807 @@
|
||||
;(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)
|
||||
root.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));
|
||||
|
||||
|
||||
return CryptoJS;
|
||||
|
||||
}));
|
||||
6657
jd_bind_card/node_modules/crypto-js/crypto-js.js
generated
vendored
Normal file
6657
jd_bind_card/node_modules/crypto-js/crypto-js.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
470
jd_bind_card/node_modules/crypto-js/docs/QuickStartGuide.wiki
generated
vendored
Normal file
470
jd_bind_card/node_modules/crypto-js/docs/QuickStartGuide.wiki
generated
vendored
Normal file
@@ -0,0 +1,470 @@
|
||||
<wiki:toc/>
|
||||
|
||||
----
|
||||
|
||||
= Quick-start Guide =
|
||||
|
||||
== Hashers ==
|
||||
|
||||
=== The Hasher Algorithms ===
|
||||
|
||||
==== MD5 ====
|
||||
|
||||
MD5 is a widely used hash function. It's been used in a variety of security applications and is also commonly used to check the integrity of files. Though, MD5 is not collision resistant, and it isn't suitable for applications like SSL certificates or digital signatures that rely on this property.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/md5.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.MD5("Message");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
==== SHA-1 ====
|
||||
|
||||
The SHA hash functions were designed by the National Security Agency (NSA). SHA-1 is the most established of the existing SHA hash functions, and it's used in a variety of security applications and protocols. Though, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha1.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA1("Message");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
==== SHA-2 ====
|
||||
|
||||
SHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it appears to provide much better security.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha256.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA256("Message");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
SHA-512 is largely identical to SHA-256 but operates on 64-bit words rather than 32.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha512.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA512("Message");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
CryptoJS also supports SHA-224 and SHA-384, which are largely identical but truncated versions of SHA-256 and SHA-512 respectively.
|
||||
|
||||
==== SHA-3 ====
|
||||
|
||||
SHA-3 is the winner of a five-year competition to select a new cryptographic hash algorithm where 64 competing designs were evaluated.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha3.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA3("Message");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
SHA-3 can be configured to output hash lengths of one of 224, 256, 384, or 512 bits. The default is 512 bits.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha3.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA3("Message", { outputLength: 512 });
|
||||
var hash = CryptoJS.SHA3("Message", { outputLength: 384 });
|
||||
var hash = CryptoJS.SHA3("Message", { outputLength: 256 });
|
||||
var hash = CryptoJS.SHA3("Message", { outputLength: 224 });
|
||||
</script>
|
||||
}}}
|
||||
|
||||
==== RIPEMD-160 ====
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/ripemd160.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.RIPEMD160("Message");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== The Hasher Input ===
|
||||
|
||||
The hash algorithms accept either strings or instances of CryptoJS.lib.WordArray. A WordArray object represents an array of 32-bit words. When you pass a string, it's automatically converted to a WordArray encoded as UTF-8.
|
||||
|
||||
=== The Hasher Output ===
|
||||
|
||||
The hash you get back isn't a string yet. It's a WordArray object. When you use a WordArray object in a string context, it's automatically converted to a hex string.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha256.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA256("Message");
|
||||
|
||||
alert(typeof hash); // object
|
||||
|
||||
alert(hash); // 2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91
|
||||
</script>
|
||||
}}}
|
||||
|
||||
You can convert a WordArray object to other formats by explicitly calling the toString method and passing an encoder.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha256.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/components/enc-base64-min.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.SHA256("Message");
|
||||
|
||||
alert(hash.toString(CryptoJS.enc.Base64)); // L3dmip37+NWEi57rSnFFypTG7ZI25Kdz9tyvpRMrL5E=
|
||||
|
||||
alert(hash.toString(CryptoJS.enc.Latin1)); // /wf<77><66>ûøÕ<C3B8><C395><EFBFBD>ëJqEÊ<45>Æí<C386>6ä§söܯ¥+/<2F>
|
||||
|
||||
alert(hash.toString(CryptoJS.enc.Hex)); // 2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== Progressive Hashing ===
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/sha256.js"></script>
|
||||
<script>
|
||||
var sha256 = CryptoJS.algo.SHA256.create();
|
||||
|
||||
sha256.update("Message Part 1");
|
||||
sha256.update("Message Part 2");
|
||||
sha256.update("Message Part 3");
|
||||
|
||||
var hash = sha256.finalize();
|
||||
</script>
|
||||
}}}
|
||||
|
||||
== HMAC ==
|
||||
|
||||
Keyed-hash message authentication codes (HMAC) is a mechanism for message authentication using cryptographic hash functions.
|
||||
|
||||
HMAC can be used in combination with any iterated cryptographic hash function.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/hmac-md5.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/hmac-sha1.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/hmac-sha256.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/hmac-sha512.js"></script>
|
||||
<script>
|
||||
var hash = CryptoJS.HmacMD5("Message", "Secret Passphrase");
|
||||
var hash = CryptoJS.HmacSHA1("Message", "Secret Passphrase");
|
||||
var hash = CryptoJS.HmacSHA256("Message", "Secret Passphrase");
|
||||
var hash = CryptoJS.HmacSHA512("Message", "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== Progressive HMAC Hashing ===
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/hmac-sha256.js"></script>
|
||||
<script>
|
||||
var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, "Secret Passphrase");
|
||||
|
||||
hmac.update("Message Part 1");
|
||||
hmac.update("Message Part 2");
|
||||
hmac.update("Message Part 3");
|
||||
|
||||
var hash = hmac.finalize();
|
||||
</script>
|
||||
}}}
|
||||
|
||||
== PBKDF2 ==
|
||||
|
||||
PBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.
|
||||
|
||||
A salt provides a large set of keys for any given password, and an iteration count increases the cost of producing keys from a password, thereby also increasing the difficulty of attack.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/pbkdf2.js"></script>
|
||||
<script>
|
||||
var salt = CryptoJS.lib.WordArray.random(128/8);
|
||||
|
||||
var key128Bits = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 128/32 });
|
||||
var key256Bits = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 256/32 });
|
||||
var key512Bits = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 512/32 });
|
||||
|
||||
var key512Bits1000Iterations = CryptoJS.PBKDF2("Secret Passphrase", salt, { keySize: 512/32, iterations: 1000 });
|
||||
</script>
|
||||
}}}
|
||||
|
||||
== Ciphers ==
|
||||
|
||||
=== The Cipher Algorithms ===
|
||||
|
||||
==== AES ====
|
||||
|
||||
The Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
CryptoJS supports AES-128, AES-192, and AES-256. It will pick the variant by the size of the key you pass in. If you use a passphrase, then it will generate a 256-bit key.
|
||||
|
||||
==== DES, Triple DES ====
|
||||
|
||||
DES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS). DES is now considered to be insecure due to the small key size.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/tripledes.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.DES.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
var decrypted = CryptoJS.DES.decrypt(encrypted, "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
Triple DES applies DES three times to each block to increase the key size. The algorithm is believed to be secure in this form.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/tripledes.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.TripleDES.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
var decrypted = CryptoJS.TripleDES.decrypt(encrypted, "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
==== Rabbit ====
|
||||
|
||||
Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2-year process where 22 designs were evaluated.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/rabbit.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.Rabbit.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
var decrypted = CryptoJS.Rabbit.decrypt(encrypted, "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
==== RC4, RC4Drop ====
|
||||
|
||||
RC4 is a widely-used stream cipher. It's used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/rc4.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.RC4.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
var decrypted = CryptoJS.RC4.decrypt(encrypted, "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
It was discovered that the first few bytes of keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-drop.
|
||||
|
||||
By default, 192 words (768 bytes) are dropped, but you can configure the algorithm to drop any number of words.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/rc4.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.RC4Drop.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
var encrypted = CryptoJS.RC4Drop.encrypt("Message", "Secret Passphrase", { drop: 3072/4 });
|
||||
|
||||
var decrypted = CryptoJS.RC4Drop.decrypt(encrypted, "Secret Passphrase", { drop: 3072/4 });
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== Custom Key and IV ===
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script>
|
||||
var key = CryptoJS.enc.Hex.parse('000102030405060708090a0b0c0d0e0f');
|
||||
var iv = CryptoJS.enc.Hex.parse('101112131415161718191a1b1c1d1e1f');
|
||||
|
||||
var encrypted = CryptoJS.AES.encrypt("Message", key, { iv: iv });
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== Block Modes and Padding ===
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/components/mode-cfb-min.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/components/pad-ansix923-min.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase", { mode: CryptoJS.mode.CFB, padding: CryptoJS.pad.AnsiX923 });
|
||||
</script>
|
||||
}}}
|
||||
|
||||
CryptoJS supports the following modes:
|
||||
|
||||
* CBC (the default)
|
||||
* CFB
|
||||
* CTR
|
||||
* OFB
|
||||
* ECB
|
||||
|
||||
And CryptoJS supports the following padding schemes:
|
||||
|
||||
* Pkcs7 (the default)
|
||||
* Iso97971
|
||||
* AnsiX923
|
||||
* Iso10126
|
||||
* ZeroPadding
|
||||
* NoPadding
|
||||
|
||||
=== The Cipher Input ===
|
||||
|
||||
For the plaintext message, the cipher algorithms accept either strings or instances of CryptoJS.lib.WordArray.
|
||||
|
||||
For the key, when you pass a string, it's treated as a passphrase and used to derive an actual key and IV. Or you can pass a WordArray that represents the actual key. If you pass the actual key, you must also pass the actual IV.
|
||||
|
||||
For the ciphertext, the cipher algorithms accept either strings or instances of CryptoJS.lib.CipherParams. A CipherParams object represents a collection of parameters such as the IV, a salt, and the raw ciphertext itself. When you pass a string, it's automatically converted to a CipherParams object according to a configurable format strategy.
|
||||
|
||||
=== The Cipher Output ===
|
||||
|
||||
The plaintext you get back after decryption is a WordArray object. See Hashers' Output for more detail.
|
||||
|
||||
The ciphertext you get back after encryption isn't a string yet. It's a CipherParams object. A CipherParams object gives you access to all the parameters used during encryption. When you use a CipherParams object in a string context, it's automatically converted to a string according to a format strategy. The default is an OpenSSL-compatible format.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script>
|
||||
var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase");
|
||||
|
||||
alert(encrypted.key); // 74eb593087a982e2a6f5dded54ecd96d1fd0f3d44a58728cdcd40c55227522223
|
||||
alert(encrypted.iv); // 7781157e2629b094f0e3dd48c4d786115
|
||||
alert(encrypted.salt); // 7a25f9132ec6a8b34
|
||||
alert(encrypted.ciphertext); // 73e54154a15d1beeb509d9e12f1e462a0
|
||||
|
||||
alert(encrypted); // U2FsdGVkX1+iX5Ey7GqLND5UFUoV0b7rUJ2eEvHkYqA=
|
||||
</script>
|
||||
}}}
|
||||
|
||||
You can define your own formats in order to be compatible with other crypto implementations. A format is an object with two methods—stringify and parse—that converts between CipherParams objects and ciphertext strings.
|
||||
|
||||
Here's how you might write a JSON formatter:
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script>
|
||||
var JsonFormatter = {
|
||||
stringify: function (cipherParams) {
|
||||
// create json object with ciphertext
|
||||
var jsonObj = {
|
||||
ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64)
|
||||
};
|
||||
|
||||
// optionally add iv and salt
|
||||
if (cipherParams.iv) {
|
||||
jsonObj.iv = cipherParams.iv.toString();
|
||||
}
|
||||
if (cipherParams.salt) {
|
||||
jsonObj.s = cipherParams.salt.toString();
|
||||
}
|
||||
|
||||
// stringify json object
|
||||
return JSON.stringify(jsonObj);
|
||||
},
|
||||
|
||||
parse: function (jsonStr) {
|
||||
// parse json string
|
||||
var jsonObj = JSON.parse(jsonStr);
|
||||
|
||||
// extract ciphertext from json object, and create cipher params object
|
||||
var cipherParams = CryptoJS.lib.CipherParams.create({
|
||||
ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct)
|
||||
});
|
||||
|
||||
// optionally extract iv and salt
|
||||
if (jsonObj.iv) {
|
||||
cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv)
|
||||
}
|
||||
if (jsonObj.s) {
|
||||
cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s)
|
||||
}
|
||||
|
||||
return cipherParams;
|
||||
}
|
||||
};
|
||||
|
||||
var encrypted = CryptoJS.AES.encrypt("Message", "Secret Passphrase", { format: JsonFormatter });
|
||||
|
||||
alert(encrypted); // {"ct":"tZ4MsEnfbcDOwqau68aOrQ==","iv":"8a8c8fd8fe33743d3638737ea4a00698","s":"ba06373c8f57179c"}
|
||||
|
||||
var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase", { format: JsonFormatter });
|
||||
|
||||
alert(decrypted.toString(CryptoJS.enc.Utf8)); // Message
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== Progressive Ciphering ===
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script>
|
||||
var key = CryptoJS.enc.Hex.parse('000102030405060708090a0b0c0d0e0f');
|
||||
var iv = CryptoJS.enc.Hex.parse('101112131415161718191a1b1c1d1e1f');
|
||||
|
||||
var aesEncryptor = CryptoJS.algo.AES.createEncryptor(key, { iv: iv });
|
||||
|
||||
var ciphertextPart1 = aesEncryptor.process("Message Part 1");
|
||||
var ciphertextPart2 = aesEncryptor.process("Message Part 2");
|
||||
var ciphertextPart3 = aesEncryptor.process("Message Part 3");
|
||||
var ciphertextPart4 = aesEncryptor.finalize();
|
||||
|
||||
var aesDecryptor = CryptoJS.algo.AES.createDecryptor(key, { iv: iv });
|
||||
|
||||
var plaintextPart1 = aesDecryptor.process(ciphertextPart1);
|
||||
var plaintextPart2 = aesDecryptor.process(ciphertextPart2);
|
||||
var plaintextPart3 = aesDecryptor.process(ciphertextPart3);
|
||||
var plaintextPart4 = aesDecryptor.process(ciphertextPart4);
|
||||
var plaintextPart5 = aesDecryptor.finalize();
|
||||
</script>
|
||||
}}}
|
||||
|
||||
=== Interoperability ===
|
||||
|
||||
==== With OpenSSL ====
|
||||
|
||||
Encrypt with OpenSSL:
|
||||
|
||||
{{{
|
||||
openssl enc -aes-256-cbc -in infile -out outfile -pass pass:"Secret Passphrase" -e -base64
|
||||
}}}
|
||||
|
||||
Decrypt with CryptoJS:
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/rollups/aes.js"></script>
|
||||
<script>
|
||||
var decrypted = CryptoJS.AES.decrypt(openSSLEncrypted, "Secret Passphrase");
|
||||
</script>
|
||||
}}}
|
||||
|
||||
== Encoders ==
|
||||
|
||||
CryptoJS can convert from encoding formats such as Base64, Latin1 or Hex to WordArray objects and vica versa.
|
||||
|
||||
{{{
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/components/core-min.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/components/enc-utf16-min.js"></script>
|
||||
<script src="http://crypto-js.googlecode.com/svn/tags/3.1/build/components/enc-base64-min.js"></script>
|
||||
<script>
|
||||
var words = CryptoJS.enc.Base64.parse('SGVsbG8sIFdvcmxkIQ==');
|
||||
var base64 = CryptoJS.enc.Base64.stringify(words);
|
||||
|
||||
var words = CryptoJS.enc.Latin1.parse('Hello, World!');
|
||||
var latin1 = CryptoJS.enc.Latin1.stringify(words);
|
||||
|
||||
var words = CryptoJS.enc.Hex.parse('48656c6c6f2c20576f726c6421');
|
||||
var hex = CryptoJS.enc.Hex.stringify(words);
|
||||
|
||||
var words = CryptoJS.enc.Utf8.parse('𤭢');
|
||||
var utf8 = CryptoJS.enc.Utf8.stringify(words);
|
||||
|
||||
var words = CryptoJS.enc.Utf16.parse('Hello, World!');
|
||||
var utf16 = CryptoJS.enc.Utf16.stringify(words);
|
||||
|
||||
var words = CryptoJS.enc.Utf16LE.parse('Hello, World!');
|
||||
var utf16 = CryptoJS.enc.Utf16LE.stringify(words);
|
||||
</script>
|
||||
}}}
|
||||
136
jd_bind_card/node_modules/crypto-js/enc-base64.js
generated
vendored
Normal file
136
jd_bind_card/node_modules/crypto-js/enc-base64.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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);
|
||||
}
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.enc.Base64;
|
||||
|
||||
}));
|
||||
148
jd_bind_card/node_modules/crypto-js/enc-base64url.js
generated
vendored
Normal file
148
jd_bind_card/node_modules/crypto-js/enc-base64url.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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) {
|
||||
if (urlSafe === undefined) {
|
||||
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) {
|
||||
if (urlSafe === undefined) {
|
||||
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);
|
||||
}
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.enc.Base64url;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/enc-hex.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/enc-hex.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.enc.Hex;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/enc-latin1.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/enc-latin1.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.enc.Latin1;
|
||||
|
||||
}));
|
||||
149
jd_bind_card/node_modules/crypto-js/enc-utf16.js
generated
vendored
Normal file
149
jd_bind_card/node_modules/crypto-js/enc-utf16.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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);
|
||||
}
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.enc.Utf16;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/enc-utf8.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/enc-utf8.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.enc.Utf8;
|
||||
|
||||
}));
|
||||
134
jd_bind_card/node_modules/crypto-js/evpkdf.js
generated
vendored
Normal file
134
jd_bind_card/node_modules/crypto-js/evpkdf.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./sha1", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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);
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.EvpKDF;
|
||||
|
||||
}));
|
||||
66
jd_bind_card/node_modules/crypto-js/format-hex.js
generated
vendored
Normal file
66
jd_bind_card/node_modules/crypto-js/format-hex.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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 });
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.format.Hex;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/format-openssl.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/format-openssl.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.format.OpenSSL;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-md5.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-md5.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./md5"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./md5", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacMD5;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-ripemd160.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-ripemd160.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./ripemd160"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./ripemd160", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacRIPEMD160;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-sha1.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-sha1.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./sha1", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacSHA1;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-sha224.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-sha224.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./sha256"), require("./sha224"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./sha256", "./sha224", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacSHA224;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-sha256.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-sha256.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./sha256", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacSHA256;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-sha3.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-sha3.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha3"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./x64-core", "./sha3", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacSHA3;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-sha384.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-sha384.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacSHA384;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/hmac-sha512.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/hmac-sha512.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./x64-core", "./sha512", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.HmacSHA512;
|
||||
|
||||
}));
|
||||
143
jd_bind_card/node_modules/crypto-js/hmac.js
generated
vendored
Normal file
143
jd_bind_card/node_modules/crypto-js/hmac.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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;
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/index.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./enc-base64url"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy"), require("./blowfish"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./enc-base64url", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy", "./blowfish"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
root.CryptoJS = factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS;
|
||||
|
||||
}));
|
||||
76
jd_bind_card/node_modules/crypto-js/lib-typedarrays.js
generated
vendored
Normal file
76
jd_bind_card/node_modules/crypto-js/lib-typedarrays.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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;
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.lib.WordArray;
|
||||
|
||||
}));
|
||||
268
jd_bind_card/node_modules/crypto-js/md5.js
generated
vendored
Normal file
268
jd_bind_card/node_modules/crypto-js/md5.js
generated
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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 variables
|
||||
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));
|
||||
|
||||
|
||||
return CryptoJS.MD5;
|
||||
|
||||
}));
|
||||
80
jd_bind_card/node_modules/crypto-js/mode-cfb.js
generated
vendored
Normal file
80
jd_bind_card/node_modules/crypto-js/mode-cfb.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.mode.CFB;
|
||||
|
||||
}));
|
||||
116
jd_bind_card/node_modules/crypto-js/mode-ctr-gladman.js
generated
vendored
Normal file
116
jd_bind_card/node_modules/crypto-js/mode-ctr-gladman.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/** @preserve
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/
|
||||
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;
|
||||
}());
|
||||
|
||||
|
||||
|
||||
|
||||
return CryptoJS.mode.CTRGladman;
|
||||
|
||||
}));
|
||||
58
jd_bind_card/node_modules/crypto-js/mode-ctr.js
generated
vendored
Normal file
58
jd_bind_card/node_modules/crypto-js/mode-ctr.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.mode.CTR;
|
||||
|
||||
}));
|
||||
40
jd_bind_card/node_modules/crypto-js/mode-ecb.js
generated
vendored
Normal file
40
jd_bind_card/node_modules/crypto-js/mode-ecb.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.mode.ECB;
|
||||
|
||||
}));
|
||||
54
jd_bind_card/node_modules/crypto-js/mode-ofb.js
generated
vendored
Normal file
54
jd_bind_card/node_modules/crypto-js/mode-ofb.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.mode.OFB;
|
||||
|
||||
}));
|
||||
42
jd_bind_card/node_modules/crypto-js/package.json
generated
vendored
Normal file
42
jd_bind_card/node_modules/crypto-js/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "crypto-js",
|
||||
"version": "4.2.0",
|
||||
"description": "JavaScript library of crypto standards.",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Evan Vosberg",
|
||||
"url": "http://github.com/evanvosberg"
|
||||
},
|
||||
"homepage": "http://github.com/brix/crypto-js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/brix/crypto-js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"security",
|
||||
"crypto",
|
||||
"Hash",
|
||||
"MD5",
|
||||
"SHA1",
|
||||
"SHA-1",
|
||||
"SHA256",
|
||||
"SHA-256",
|
||||
"RC4",
|
||||
"Rabbit",
|
||||
"AES",
|
||||
"DES",
|
||||
"PBKDF2",
|
||||
"HMAC",
|
||||
"OFB",
|
||||
"CFB",
|
||||
"CTR",
|
||||
"CBC",
|
||||
"Base64",
|
||||
"Base64url"
|
||||
],
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"browser": {
|
||||
"crypto": false
|
||||
}
|
||||
}
|
||||
49
jd_bind_card/node_modules/crypto-js/pad-ansix923.js
generated
vendored
Normal file
49
jd_bind_card/node_modules/crypto-js/pad-ansix923.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return CryptoJS.pad.Ansix923;
|
||||
|
||||
}));
|
||||
44
jd_bind_card/node_modules/crypto-js/pad-iso10126.js
generated
vendored
Normal file
44
jd_bind_card/node_modules/crypto-js/pad-iso10126.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return CryptoJS.pad.Iso10126;
|
||||
|
||||
}));
|
||||
40
jd_bind_card/node_modules/crypto-js/pad-iso97971.js
generated
vendored
Normal file
40
jd_bind_card/node_modules/crypto-js/pad-iso97971.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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--;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return CryptoJS.pad.Iso97971;
|
||||
|
||||
}));
|
||||
30
jd_bind_card/node_modules/crypto-js/pad-nopadding.js
generated
vendored
Normal file
30
jd_bind_card/node_modules/crypto-js/pad-nopadding.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* A noop padding strategy.
|
||||
*/
|
||||
CryptoJS.pad.NoPadding = {
|
||||
pad: function () {
|
||||
},
|
||||
|
||||
unpad: function () {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return CryptoJS.pad.NoPadding;
|
||||
|
||||
}));
|
||||
18
jd_bind_card/node_modules/crypto-js/pad-pkcs7.js
generated
vendored
Normal file
18
jd_bind_card/node_modules/crypto-js/pad-pkcs7.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
return CryptoJS.pad.Pkcs7;
|
||||
|
||||
}));
|
||||
47
jd_bind_card/node_modules/crypto-js/pad-zeropadding.js
generated
vendored
Normal file
47
jd_bind_card/node_modules/crypto-js/pad-zeropadding.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return CryptoJS.pad.ZeroPadding;
|
||||
|
||||
}));
|
||||
145
jd_bind_card/node_modules/crypto-js/pbkdf2.js
generated
vendored
Normal file
145
jd_bind_card/node_modules/crypto-js/pbkdf2.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./sha256", "./hmac"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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 SHA256 = C_algo.SHA256;
|
||||
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: SHA256
|
||||
* @property {number} iterations The number of iterations to perform. Default: 250000
|
||||
*/
|
||||
cfg: Base.extend({
|
||||
keySize: 128/32,
|
||||
hasher: SHA256,
|
||||
iterations: 250000
|
||||
}),
|
||||
|
||||
/**
|
||||
* 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);
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
return CryptoJS.PBKDF2;
|
||||
|
||||
}));
|
||||
190
jd_bind_card/node_modules/crypto-js/rabbit-legacy.js
generated
vendored
Normal file
190
jd_bind_card/node_modules/crypto-js/rabbit-legacy.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
|
||||
}
|
||||
else {
|
||||
// Global (browser)
|
||||
factory(root.CryptoJS);
|
||||
}
|
||||
}(this, function (CryptoJS) {
|
||||
|
||||
(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.RabbitLegacy;
|
||||
|
||||
}));
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user