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 Storage = require('./src/utils/Storage')
const crypto = require('./src/utils/Crypto')
const crypto = require('./src/utils/TsCrypto')
const GlobalConfig = require('./src/utils/GlobalConfig')
const SM4 = require('./src/utils/SM4')
const SM4 = require('./src/utils/TsSM4')
const HttpUtil = require('./src/https/HttpUtil')
module.exports = {

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
const base64js = require("base64-js");
const SM4 = require("./SM4");
const GlobalConfig = require("../utils/GlobalConfig");
const SM4 = require("./TsSM4");
const GlobalConfig = require("../utils/TsGlobalConfig");
class Crypto {
class TsCrypto {
constructor() {
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.
* @param {Object} config
* @memberof SM4
* @memberof TsSM4
*/
constructor(config) {
if (config.keyBuffer.length !== 16) {
@@ -161,7 +161,7 @@ class SM4 {
* @param {Uint32Array} blockData
* @param {Uint32Array} roundKeys
* @return {Uint32Array} return a 16 bytes cipher block
* @memberof SM4
* @memberof TsSM4
*/
doBlockCrypt(blockData, roundKeys) {
let xBlock = new Uint32Array(36)
@@ -184,7 +184,7 @@ class SM4 {
* every round key's length is 32 bytes.
* there are 32 round keys.
* @return {Uint32Array}
* @memberof SM4
* @memberof TsSM4
*/
spawnEncryptRoundKeys() {
// extract mk in key
@@ -212,7 +212,7 @@ class SM4 {
* @param {*} x
* @param {Number} y
* @returns
* @memberof SM4
* @memberof TsSM4
*/
rotateLeft(x, y) {
return x << y | x >>> (32 - y)
@@ -223,7 +223,7 @@ class SM4 {
*
* @param {Uint32Number} b
* @returns {Uint32Number}
* @memberof SM4
* @memberof TsSM4
*/
linearTransform1(b) {
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
* @returns {Uint32Number}
* @memberof SM4
* @memberof TsSM4
*/
linearTransform2(b) {
return b ^ this.rotateLeft(b, 13) ^ this.rotateLeft(b, 23)
@@ -245,7 +245,7 @@ class SM4 {
*
* @param {Uint32Number} a
* @returns {Uint32Number}
* @memberof SM4
* @memberof TsSM4
*/
tauTransform(a) {
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
* @returns {Uint32Number}
* @memberof SM4
* @memberof TsSM4
*/
tTransform1(z) {
let b = this.tauTransform(z)
@@ -269,7 +269,7 @@ class SM4 {
*
* @param {Uint32Number} z
* @returns {Uint32Number}
* @memberof SM4
* @memberof TsSM4
*/
tTransform2(z) {
let b = this.tauTransform(z)
@@ -282,7 +282,7 @@ class SM4 {
*
* @param {ByteArray} originalBuffer
* @returns {ByteArray}
* @memberof SM4
* @memberof TsSM4
*/
padding(originalBuffer) {
if (originalBuffer === null) {
@@ -300,7 +300,7 @@ class SM4 {
*
* @param {ByteArray} paddedBuffer
* @returns {ByteArray}
* @memberof SM4
* @memberof TsSM4
*/
dePadding(paddedBuffer) {
if (paddedBuffer === null) {
@@ -317,7 +317,7 @@ class SM4 {
* @param {Uint8Array} uint8Array
* @param {Number} baseIndex
* @returns {Uint32Array}
* @memberof SM4
* @memberof TsSM4
*/
uint8ToUint32Block(uint8Array, baseIndex = 0) {
let block = new Uint32Array(4)// make Uint8Array to Uint32Array block
@@ -332,7 +332,7 @@ class SM4 {
* encrypt the string plaintext
*
* @param {String} plaintext
* @memberof SM4
* @memberof TsSM4
* @return {String} ciphertext
*/
encrypt(plaintext) {
@@ -390,7 +390,7 @@ class SM4 {
* decrypt the string ciphertext
*
* @param {String} ciphertext
* @memberof SM4
* @memberof TsSM4
*/
decrypt(ciphertext) {
// 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