aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt24
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt22
2 files changed, 20 insertions, 26 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt
index 73141c1a..98e9bfe4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt
@@ -160,15 +160,13 @@ internal object Phonemes {
// Handle DIGITS
if (pwFlags and PasswordGenerator.DIGITS > 0) {
if (!first && RandomNumberGenerator.number(10) < 3) {
- var `val`: String
+ var character: String
do {
cha = Character.forDigit(RandomNumberGenerator.number(10), 10)
- `val` = cha.toString()
- } while (pwFlags and PasswordGenerator.AMBIGUOUS > 0 && PasswordGenerator.AMBIGUOUS_STR.contains(
- `val`
- )
- )
- password += `val`
+ character = cha.toString()
+ } while (pwFlags and PasswordGenerator.AMBIGUOUS > 0 &&
+ PasswordGenerator.AMBIGUOUS_STR.contains(character))
+ password += character
curSize++
featureFlags = featureFlags and PasswordGenerator.DIGITS.inv()
@@ -183,17 +181,15 @@ internal object Phonemes {
// Handle SYMBOLS
if (pwFlags and PasswordGenerator.SYMBOLS > 0) {
if (!first && RandomNumberGenerator.number(10) < 2) {
- var `val`: String
+ var character: String
var num: Int
do {
num = RandomNumberGenerator.number(PasswordGenerator.SYMBOLS_STR.length)
cha = PasswordGenerator.SYMBOLS_STR.toCharArray()[num]
- `val` = cha.toString()
- } while (pwFlags and PasswordGenerator.AMBIGUOUS > 0 && PasswordGenerator.AMBIGUOUS_STR.contains(
- `val`
- )
- )
- password += `val`
+ character = cha.toString()
+ } while (pwFlags and PasswordGenerator.AMBIGUOUS > 0 &&
+ PasswordGenerator.AMBIGUOUS_STR.contains(character))
+ password += character
curSize++
featureFlags = featureFlags and PasswordGenerator.SYMBOLS.inv()
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
index 66147709..e3ae3397 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
@@ -25,7 +25,7 @@ internal object RandomPasswordGenerator {
var i: Int
var featureFlags: Int
var num: Int
- var `val`: String
+ var character: String
var bank = ""
if (pwFlags and PasswordGenerator.DIGITS > 0) {
@@ -47,28 +47,26 @@ internal object RandomPasswordGenerator {
while (i < size) {
num = RandomNumberGenerator.number(bank.length)
cha = bank.toCharArray()[num]
- `val` = cha.toString()
- if (pwFlags and PasswordGenerator.AMBIGUOUS > 0 && PasswordGenerator.AMBIGUOUS_STR.contains(
- `val`
- )
- ) {
+ character = cha.toString()
+ if (pwFlags and PasswordGenerator.AMBIGUOUS > 0
+ && PasswordGenerator.AMBIGUOUS_STR.contains(character)) {
continue
}
- if (pwFlags and PasswordGenerator.NO_VOWELS > 0 && PasswordGenerator.VOWELS_STR.contains(`val`)) {
+ if (pwFlags and PasswordGenerator.NO_VOWELS > 0 && PasswordGenerator.VOWELS_STR.contains(character)) {
continue
}
- password += `val`
+ password += character
i++
- if (PasswordGenerator.DIGITS_STR.contains(`val`)) {
+ if (PasswordGenerator.DIGITS_STR.contains(character)) {
featureFlags = featureFlags and PasswordGenerator.DIGITS.inv()
}
- if (PasswordGenerator.UPPERS_STR.contains(`val`)) {
+ if (PasswordGenerator.UPPERS_STR.contains(character)) {
featureFlags = featureFlags and PasswordGenerator.UPPERS.inv()
}
- if (PasswordGenerator.SYMBOLS_STR.contains(`val`)) {
+ if (PasswordGenerator.SYMBOLS_STR.contains(character)) {
featureFlags = featureFlags and PasswordGenerator.SYMBOLS.inv()
}
- if (PasswordGenerator.LOWERS_STR.contains(`val`)) {
+ if (PasswordGenerator.LOWERS_STR.contains(character)) {
featureFlags = featureFlags and PasswordGenerator.LOWERS.inv()
}
}