Skip to content

Commit

Permalink
base64命令 去掉 -w 0,macOS不支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Finb committed May 29, 2024
1 parent 0238cac commit a49b998
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Bark/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ ivComment = "IV can be randomly generated, but if it is random, it needs to be p
opensslEncodingComment = "openssl requires Hex encoding of manual keys and IVs, not ASCII encoding.";
ciphertextComment = "URL encoding the ciphertext, there may be special characters.";
consoleComment = "The console will print";
base64Notice = "If you get a 'Decryption Failed' prompt, try adding '-w 0' after the base64 command.";
keyComment = "Must be %d bit long";

removeMessage = "Remove";
Expand Down
1 change: 1 addition & 0 deletions Bark/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ ivComment = "IV rastgele oluşturulabilir, ancak rastgele ise iv parametresinde
opensslEncodingComment = "openssl, manuel anahtarların ve IV'lerin ASCII kodlamasını değil, Hex kodlamasını gerektirir.";
ciphertextComment = "URL şifreli metni kodlarken özel karakterler olabilir.";
consoleComment = "Konsola şunları yazdırır";
base64Notice = "If you get a 'Decryption Failed' prompt, try adding '-w 0' after the base64 command.";
keyComment = "%d bit uzunluğunda olmalıdır";

removeMessage = "Sil";
Expand Down
1 change: 1 addition & 0 deletions Bark/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ ivComment = "IV可以是随机生成的,但如果是随机的就需要放在 i
opensslEncodingComment = "OpenSSL 要求输入的 Key 和 IV 需使用十六进制编码。";
ciphertextComment = "密文可能有特殊字符,所以记得 URL 编码一下。";
consoleComment = "控制台将打印";
base64Notice = "如果提示 Decryption Failed, 尝试在 base64 命令后面 加上 -w 0";
keyComment = "必须%d位";

removeMessage = "删除";
Expand Down
5 changes: 3 additions & 2 deletions Controller/CryptoSettingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
# \(NSLocalizedString("opensslEncodingComment"))
key=$(printf $key | xxd -ps -c 200)
iv=$(printf $iv | xxd -ps -c 200)
ciphertext=$(echo -n $json | openssl enc -aes-\(fields.algorithm.suffix(3))-\(fields.mode.lowercased()) -K $key \(iv.count > 0 ? "-iv $iv " : "")| base64 -w 0)
# \(NSLocalizedString("base64Notice"))
ciphertext=$(echo -n $json | openssl enc -aes-\(fields.algorithm.suffix(3))-\(fields.mode.lowercased()) -K $key \(iv.count > 0 ? "-iv $iv " : "")| base64)
# \(NSLocalizedString("consoleComment")) "\((try? AESCryptoModel(cryptoFields: fields).encrypt(text: "{\"body\": \"test\", \"sound\": \"birdsong\"}")) ?? "")"
echo $ciphertext
Expand Down

0 comments on commit a49b998

Please sign in to comment.