This commit is contained in:
2024-10-05 04:22:34 +08:00
parent 5993f231fd
commit 30911fcf5c
298 changed files with 28632 additions and 28632 deletions

View File

@@ -1,26 +1,26 @@
export default class HaoEncrypt {
public static encode(str: string) {
let result: string = ''
for (let i = 0; i < str.length; i++) {
// 遍历字符串
let code: number = str.charCodeAt(i) // //逐个提取每个字符并获取Unicode编码值
if (i % 2 === 0) code += 2
else code += 1
result += String.fromCharCode(code)
}
return result
}
public static decode(str: string) {
let result: string = ''
for (let i = 0; i < str.length; i++) {
// 遍历字符串
let code: number = str.charCodeAt(i) // //逐个提取每个字符并获取Unicode编码值
if (i % 2 === 0) code -= 2
else code -= 1
result += String.fromCharCode(code)
}
return result
}
}
export default class HaoEncrypt {
public static encode(str: string) {
let result: string = ''
for (let i = 0; i < str.length; i++) {
// 遍历字符串
let code: number = str.charCodeAt(i) // //逐个提取每个字符并获取Unicode编码值
if (i % 2 === 0) code += 2
else code += 1
result += String.fromCharCode(code)
}
return result
}
public static decode(str: string) {
let result: string = ''
for (let i = 0; i < str.length; i++) {
// 遍历字符串
let code: number = str.charCodeAt(i) // //逐个提取每个字符并获取Unicode编码值
if (i % 2 === 0) code -= 2
else code -= 1
result += String.fromCharCode(code)
}
return result
}
}