perf:更新文件名称

This commit is contained in:
曾文豪
2024-11-06 23:16:38 +08:00
parent a7c3c76dd2
commit a2a5ba43d6
8 changed files with 28 additions and 28 deletions

View File

@@ -1,8 +1,8 @@
const Common = require('./src/utils/Common') const Common = require('./src/utils/Common')
const Storage = require('./src/utils/Storage') const Storage = require('./src/utils/Storage')
const crypto = require('./src/utils/Crypto') const crypto = require('./src/utils/TsCrypto')
const GlobalConfig = require('./src/utils/GlobalConfig') const GlobalConfig = require('./src/utils/GlobalConfig')
const SM4 = require('./src/utils/SM4') const SM4 = require('./src/utils/TsSM4')
const HttpUtil = require('./src/https/HttpUtil') const HttpUtil = require('./src/https/HttpUtil')
module.exports = { module.exports = {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@tiesheng/npm-tool", "name": "@tiesheng/npm-tool",
"version": "1.0.16", "version": "2.0.0",
"description": "npm tool package", "description": "npm tool package",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@@ -1,8 +1,8 @@
const {extend} = require('umi-request'); const {extend} = require('umi-request');
const Storage = require('../utils/Storage'); const Storage = require('../utils/TsStorage');
const Common = require('../utils/Common'); const Common = require('../utils/TsCommon');
const crypto = require("../utils/Crypto"); const crypto = require("../utils/TsCrypto");
const GlobalConfig = require("../utils/GlobalConfig"); const GlobalConfig = require("../utils/TsGlobalConfig");
const codeMessage = { const codeMessage = {
200: "服务器成功返回请求的数据。", 200: "服务器成功返回请求的数据。",

View File

@@ -1,8 +1,8 @@
const base64js = require("base64-js"); const base64js = require("base64-js");
const SM4 = require("./SM4"); const SM4 = require("./TsSM4");
const GlobalConfig = require("../utils/GlobalConfig"); const GlobalConfig = require("../utils/TsGlobalConfig");
class Crypto { class TsCrypto {
constructor() { constructor() {
this.sm4 = new SM4({ this.sm4 = new SM4({
@@ -30,4 +30,4 @@ class Crypto {
} }
} }
module.exports = new Crypto(); module.exports = new TsCrypto();

View File

@@ -93,11 +93,11 @@ class Crypt {
} }
} }
class SM4 { class TsSM4 {
/** /**
* Creates an instance of SM4. * Creates an instance of SM4.
* @param {Object} config * @param {Object} config
* @memberof SM4 * @memberof TsSM4
*/ */
constructor(config) { constructor(config) {
if (config.keyBuffer.length !== 16) { if (config.keyBuffer.length !== 16) {
@@ -161,7 +161,7 @@ class SM4 {
* @param {Uint32Array} blockData * @param {Uint32Array} blockData
* @param {Uint32Array} roundKeys * @param {Uint32Array} roundKeys
* @return {Uint32Array} return a 16 bytes cipher block * @return {Uint32Array} return a 16 bytes cipher block
* @memberof SM4 * @memberof TsSM4
*/ */
doBlockCrypt(blockData, roundKeys) { doBlockCrypt(blockData, roundKeys) {
let xBlock = new Uint32Array(36) let xBlock = new Uint32Array(36)
@@ -184,7 +184,7 @@ class SM4 {
* every round key's length is 32 bytes. * every round key's length is 32 bytes.
* there are 32 round keys. * there are 32 round keys.
* @return {Uint32Array} * @return {Uint32Array}
* @memberof SM4 * @memberof TsSM4
*/ */
spawnEncryptRoundKeys() { spawnEncryptRoundKeys() {
// extract mk in key // extract mk in key
@@ -212,7 +212,7 @@ class SM4 {
* @param {*} x * @param {*} x
* @param {Number} y * @param {Number} y
* @returns * @returns
* @memberof SM4 * @memberof TsSM4
*/ */
rotateLeft(x, y) { rotateLeft(x, y) {
return x << y | x >>> (32 - y) return x << y | x >>> (32 - y)
@@ -223,7 +223,7 @@ class SM4 {
* *
* @param {Uint32Number} b * @param {Uint32Number} b
* @returns {Uint32Number} * @returns {Uint32Number}
* @memberof SM4 * @memberof TsSM4
*/ */
linearTransform1(b) { linearTransform1(b) {
return b ^ this.rotateLeft(b, 2) ^ this.rotateLeft(b, 10) ^ this.rotateLeft(b, 18) ^ this.rotateLeft(b, 24) return b ^ this.rotateLeft(b, 2) ^ this.rotateLeft(b, 10) ^ this.rotateLeft(b, 18) ^ this.rotateLeft(b, 24)
@@ -234,7 +234,7 @@ class SM4 {
* *
* @param {Uint32Number} b * @param {Uint32Number} b
* @returns {Uint32Number} * @returns {Uint32Number}
* @memberof SM4 * @memberof TsSM4
*/ */
linearTransform2(b) { linearTransform2(b) {
return b ^ this.rotateLeft(b, 13) ^ this.rotateLeft(b, 23) return b ^ this.rotateLeft(b, 13) ^ this.rotateLeft(b, 23)
@@ -245,7 +245,7 @@ class SM4 {
* *
* @param {Uint32Number} a * @param {Uint32Number} a
* @returns {Uint32Number} * @returns {Uint32Number}
* @memberof SM4 * @memberof TsSM4
*/ */
tauTransform(a) { tauTransform(a) {
return Sbox[a >>> 24 & 0xff] << 24 | Sbox[a >>> 16 & 0xff] << 16 | Sbox[a >>> 8 & 0xff] << 8 | Sbox[a & 0xff] return Sbox[a >>> 24 & 0xff] << 24 | Sbox[a >>> 16 & 0xff] << 16 | Sbox[a >>> 8 & 0xff] << 8 | Sbox[a & 0xff]
@@ -256,7 +256,7 @@ class SM4 {
* *
* @param {Uint32Number} z * @param {Uint32Number} z
* @returns {Uint32Number} * @returns {Uint32Number}
* @memberof SM4 * @memberof TsSM4
*/ */
tTransform1(z) { tTransform1(z) {
let b = this.tauTransform(z) let b = this.tauTransform(z)
@@ -269,7 +269,7 @@ class SM4 {
* *
* @param {Uint32Number} z * @param {Uint32Number} z
* @returns {Uint32Number} * @returns {Uint32Number}
* @memberof SM4 * @memberof TsSM4
*/ */
tTransform2(z) { tTransform2(z) {
let b = this.tauTransform(z) let b = this.tauTransform(z)
@@ -282,7 +282,7 @@ class SM4 {
* *
* @param {ByteArray} originalBuffer * @param {ByteArray} originalBuffer
* @returns {ByteArray} * @returns {ByteArray}
* @memberof SM4 * @memberof TsSM4
*/ */
padding(originalBuffer) { padding(originalBuffer) {
if (originalBuffer === null) { if (originalBuffer === null) {
@@ -300,7 +300,7 @@ class SM4 {
* *
* @param {ByteArray} paddedBuffer * @param {ByteArray} paddedBuffer
* @returns {ByteArray} * @returns {ByteArray}
* @memberof SM4 * @memberof TsSM4
*/ */
dePadding(paddedBuffer) { dePadding(paddedBuffer) {
if (paddedBuffer === null) { if (paddedBuffer === null) {
@@ -317,7 +317,7 @@ class SM4 {
* @param {Uint8Array} uint8Array * @param {Uint8Array} uint8Array
* @param {Number} baseIndex * @param {Number} baseIndex
* @returns {Uint32Array} * @returns {Uint32Array}
* @memberof SM4 * @memberof TsSM4
*/ */
uint8ToUint32Block(uint8Array, baseIndex = 0) { uint8ToUint32Block(uint8Array, baseIndex = 0) {
let block = new Uint32Array(4)// make Uint8Array to Uint32Array block let block = new Uint32Array(4)// make Uint8Array to Uint32Array block
@@ -332,7 +332,7 @@ class SM4 {
* encrypt the string plaintext * encrypt the string plaintext
* *
* @param {String} plaintext * @param {String} plaintext
* @memberof SM4 * @memberof TsSM4
* @return {String} ciphertext * @return {String} ciphertext
*/ */
encrypt(plaintext) { encrypt(plaintext) {
@@ -390,7 +390,7 @@ class SM4 {
* decrypt the string ciphertext * decrypt the string ciphertext
* *
* @param {String} ciphertext * @param {String} ciphertext
* @memberof SM4 * @memberof TsSM4
*/ */
decrypt(ciphertext) { decrypt(ciphertext) {
// get cipher byte array // get cipher byte array
@@ -452,4 +452,4 @@ class SM4 {
} }
} }
module.exports = SM4 module.exports = TsSM4

View File

@@ -1,4 +1,4 @@
const Common = require("./Common"); const Common = require("./TsCommon");
///////////////////////////////////////// 用户token ///////////////////////////////////////// 用户token