Files
e-party-iOS/yana/Utils/Security/DESEncryptOCTest.swift
edwinQQQ 128bf36c88 feat: 更新依赖和项目配置,优化代码结构
- 在Package.swift中注释掉旧的swift-composable-architecture依赖,并添加swift-case-paths依赖。
- 在Podfile中将iOS平台版本更新至16.0,并移除QCloudCOSXML/Transfer依赖,改为使用QCloudCOSXML。
- 更新Podfile.lock以反映依赖变更,确保项目依赖的准确性。
- 新增架构分析需求文档,明确项目架构评估和改进建议。
- 在多个文件中实现async/await语法,提升异步操作的可读性和性能。
- 更新日志输出方法,确保在调试模式下提供一致的调试信息。
- 优化多个视图组件,提升用户体验和代码可维护性。
2025-07-17 18:47:09 +08:00

52 lines
1.6 KiB
Swift

import Foundation
/// OCDES
struct DESEncryptOCTest {
/// OC DES
static func testOCDESEncryption() {
debugInfoSync("🧪 开始测试 OC 版本的 DES 加密...")
debugInfoSync(String(repeating: "=", count: 50))
let key = "1ea53d260ecf11e7b56e00163e046a26"
let testCases = [
"test123",
"hello world",
"password123",
"sample_data",
"encrypt_test"
]
for testCase in testCases {
if let encrypted = DESEncrypt.encryptUseDES(testCase, key: key) {
debugInfoSync("✅ 加密成功:")
debugInfoSync(" 原文: \"\(testCase)\"")
debugInfoSync(" 密文: \(encrypted)")
//
if let decrypted = DESEncrypt.decryptUseDES(encrypted, key: key) {
let isMatch = decrypted == testCase
debugInfoSync(" 解密: \"\(decrypted)\" \(isMatch ? "" : "")")
} else {
debugErrorSync(" 解密: 失败 ❌")
}
} else {
debugErrorSync("❌ 加密失败: \"\(testCase)\"")
}
debugInfoSync("")
}
debugInfoSync(String(repeating: "=", count: 50))
debugInfoSync("🏁 OC版本DES加密测试完成")
}
}
#if DEBUG
extension DESEncryptOCTest {
/// AppDelegate
static func runInAppDelegate() {
DESEncryptOCTest.testOCDESEncryption()
}
}
#endif