Skip to content

Commit 6c4ba0c

Browse files
committed
feat(app): 提示信息新增输入输出长度显示
1 parent 59e4072 commit 6c4ba0c

7 files changed

+35
-10
lines changed

app/src/main/kotlin/me/leon/view/AsymmetricCryptoView.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class AsymmetricCryptoView : Fragment(FX.messages["asymmetric"]) {
4040
"${selectedAlg.get()} bits: ${selectedBits.get()} mode: ${
4141
if (privateKeyEncrypt.get()) "private key encrypt"
4242
else "public key encrypt"
43-
} cost: $timeConsumption ms"
43+
}" +
44+
"${messages["inputLength"]}: ${inputText.length} " +
45+
"${messages["outputLength"]}: ${outputText.length} " +
46+
" cost: $timeConsumption ms"
4447
private val selectedPadding = SimpleStringProperty(RSA_PADDINGS.first())
4548
private lateinit var labelInfo: Label
4649
private var keyText: String

app/src/main/kotlin/me/leon/view/DigestView.kt

+9-4
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ class DigestView : Fragment(messages["hash"]) {
5757
lateinit var cbBits: ComboBox<String>
5858
private val info
5959
get() =
60-
"Hash: $method bits: ${selectedBits.get()} count: $times cost: $timeConsumption ms" +
61-
" file mode: ${isFileMode.get()}"
60+
"Hash: $method bits: ${selectedBits.get()} " +
61+
"${messages["inputLength"]}: ${inputText.length} " +
62+
"${messages["outputLength"]}: ${outputText.length} " +
63+
"count: $times cost: $timeConsumption ms " +
64+
"file mode: ${isFileMode.get()}"
6265

6366
private var timeConsumption = 0L
6467
private var startTime = 0L
@@ -118,8 +121,10 @@ class DigestView : Fragment(messages["hash"]) {
118121
newValue
119122
} else {
120123
isEnableFileMode.value = true
121-
"${selectedAlgItem.get()}${newValue
122-
.takeIf { ALGOS_HASH[selectedAlgItem.get()]!!.size > 1 } ?: ""}"
124+
"${selectedAlgItem.get()}${
125+
newValue
126+
.takeIf { ALGOS_HASH[selectedAlgItem.get()]!!.size > 1 } ?: ""
127+
}"
123128
.replace("SHA2", "SHA-")
124129
.replace(
125130
"(Haraka|GOST3411-2012|Keccak|SHA3|Blake2b|Blake2s|DSTU7564|Skein)".toRegex(),

app/src/main/kotlin/me/leon/view/MacView.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ class MacView : Fragment("MAC") {
5050
private val selectedBits = SimpleStringProperty(algorithm.values.first().first())
5151
private lateinit var cbBits: ComboBox<String>
5252
private val info
53-
get() = "MAC: $method cost: $timeConsumption ms"
53+
get() =
54+
"MAC: $method " +
55+
"${messages["inputLength"]}: ${inputText.length} " +
56+
"${messages["outputLength"]}: ${outputText.length} " +
57+
"cost: $timeConsumption ms"
5458
private var inputEncode = "raw"
5559
private var outputEncode = "hex"
5660
private lateinit var tgInput: ToggleGroup

app/src/main/kotlin/me/leon/view/PBEView.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ class PBEView : Fragment("PBE") {
3939
private var timeConsumption = 0L
4040
private var startTime = 0L
4141
private val info
42-
get() = "PBE Cipher: $cipher charset: ${selectedCharset.get()} cost: $timeConsumption ms"
42+
get() =
43+
"PBE Cipher: $cipher charset: ${selectedCharset.get()} " +
44+
"${messages["inputLength"]}: ${inputText.length} " +
45+
"${messages["outputLength"]}: ${outputText.length} " +
46+
"cost: $timeConsumption ms"
4347
private lateinit var infoLabel: Label
4448

4549
private var saltEncode = "hex"

app/src/main/kotlin/me/leon/view/SignatureView.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ class SignatureView : Fragment(messages["signVerify"]) {
146146
private var startTime = 0L
147147
private val info
148148
get() =
149-
"Signature: ${selectedKeyPairAlg.get()} hash: ${selectedSigAlg.get()} cost: $timeConsumption ms"
149+
"Signature: ${selectedKeyPairAlg.get()} hash: ${selectedSigAlg.get()} " +
150+
"${messages["inputLength"]}: ${msg.length} " +
151+
"${messages["outputLength"]}: ${signText.length} " +
152+
"cost: $timeConsumption ms"
150153
private var inputEncode = "raw"
151154
private lateinit var tgInput: ToggleGroup
152155
private val centerNode = vbox {

app/src/main/kotlin/me/leon/view/SymmetricCryptoStreamView.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ class SymmetricCryptoStreamView : Fragment(messages["symmetricStream"]) {
3333
private var startTime = 0L
3434
private val info
3535
get() =
36-
"Cipher: $cipher charset: ${selectedCharset.get()} file mode: ${isFile.get()} cost: $timeConsumption ms"
36+
"Cipher: $cipher charset: ${selectedCharset.get()} file mode: ${isFile.get()} " +
37+
"${messages["inputLength"]}: ${inputText.length} " +
38+
"${messages["outputLength"]}: ${outputText.length} " +
39+
"cost: $timeConsumption ms"
3740
private lateinit var infoLabel: Label
3841
private val keyIvInputView = KeyIvInputView(isEnableIv)
3942
private var inputEncode = "raw"

app/src/main/kotlin/me/leon/view/SymmetricCryptoView.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ class SymmetricCryptoView : Fragment(messages["symmetricBlock"]) {
3737
private var startTime = 0L
3838
private val info
3939
get() =
40-
"Cipher: $cipher charset: ${selectedCharset.get()} file mode: ${isFile.get()} cost: $timeConsumption ms"
40+
"Cipher: $cipher charset: ${selectedCharset.get()} file mode: ${isFile.get()} " +
41+
"${messages["inputLength"]}: ${inputText.length} " +
42+
"${messages["outputLength"]}: ${outputText.length} " +
43+
"cost: $timeConsumption ms"
4144
private lateinit var labelInfo: Label
4245
private val keyIvInputView = KeyIvInputView(isEnableIv, isEnableAEAD)
4346
private var inputEncode = "raw"

0 commit comments

Comments
 (0)