mirror of
https://github.com/Finb/Bark.git
synced 2026-04-25 22:15:52 +03:00
[PR #341] [CLOSED] 支持输入 Hex 格式的 AES Key 和 IV (不再强制 UTF-8) #338
Labels
No labels
bug
enhancement
in progress
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Bark#338
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Finb/Bark/pull/341
Author: @kio235
Created: 2/13/2026
Status: ❌ Closed
Base:
master← Head:fix/support-hex📝 Commits (1)
f1fc1f8feat: Support Hex-encoded Key and IV strings & update generation script📊 Changes
4 files changed (+80 additions, -21 deletions)
View changed files
📝
Controller/CryptoSettingViewModel.swift(+3 -3)📝
Model/Algorithm.swift(+40 -7)📝
docs/en-us/encryption.md(+19 -5)📝
docs/encryption.md(+18 -6)📄 Description
之前的逻辑强制把 Key 和 IV 当成普通字符串 (UTF-8) 处理, 导致不兼容 OpenSSL 生成标准的随机密钥
给 Key 和 IV 添加智能判断:
如果长度等于标准长度(比如 16),照旧按普通字符串处理 -> 兼容老版本。
如果长度是标准的 2 倍(比如 32)且是有效的 Hex,自动转成二进制数据处理 -> 支持 Hex 输入。
现在 AES 初始化使用 [UInt8] 字节数组。
同时对文档进行了更新
我不太懂ios开发, 最近在使用的时候, 尝试使用
openssl rand -hex 16作为 iv, 遇到了这个问题,尝试修改了一下, 希望能有帮助
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.