mirror of
https://github.com/wneessen/apg-go.git
synced 2024-12-23 03:30:39 +01:00
v0.3.1: New password length behaviour
To address issue #13, the password length behaviour of the original APG has been reproduced. Previously, when a minLength of 5 and a maxLength of 10 was given, apg-go se the pwLength to the preferred maxLength. With v0.3.1 it will choose a random length between minLength and maxLength instead, same as the original C-lang apg did. For this the minLength has been defaulted to a sane value of 12 (instead of the 8 of the original apg). The default for maxLength stayed at 20. Also the default number of generated passwords has been changed from 1 to 6, to replicate the behaviour of the original apg.
This commit is contained in:
parent
9277e83fd4
commit
eaf4a4c57d
2 changed files with 9 additions and 11 deletions
|
@ -4,13 +4,9 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fbb0c733-4aa1-4d27-87d5-c7276d8aa613" name="Default Changelist" comment="">
|
||||
<list default="true" id="fbb0c733-4aa1-4d27-87d5-c7276d8aa613" name="Default Changelist" comment="v0.3.1: New password length behaviour To address issue #13, the password length behaviour of the original APG has been reproduced. Previously, when a minLength of 5 and a maxLength of 10 was given, apg-go se the pwLength to the preferred maxLength. With v0.3.1 it will choose a random length between minLength and maxLength instead, same as the original C-lang apg did. For this the minLength has been defaulted to a sane value of 12 (instead of the 8 of the original apg). The default for maxLength stayed at 20. Also the default number of generated passwords has been changed from 1 to 6, to replicate the behaviour of the original apg.">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apg.go" beforeDir="false" afterPath="$PROJECT_DIR$/apg.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/apg_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/apg_test.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/config.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/rand.go" beforeDir="false" afterPath="$PROJECT_DIR$/rand.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -234,7 +230,8 @@
|
|||
<MESSAGE value="New DEV branch" />
|
||||
<MESSAGE value="v0.2.9: Replaced standard go-help with custom usage text" />
|
||||
<MESSAGE value="v0.3.0: Unified the naming convention" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="v0.3.0: Unified the naming convention" />
|
||||
<MESSAGE value="v0.3.1: New password length behaviour To address issue #13, the password length behaviour of the original APG has been reproduced. Previously, when a minLength of 5 and a maxLength of 10 was given, apg-go se the pwLength to the preferred maxLength. With v0.3.1 it will choose a random length between minLength and maxLength instead, same as the original C-lang apg did. For this the minLength has been defaulted to a sane value of 12 (instead of the 8 of the original apg). The default for maxLength stayed at 20. Also the default number of generated passwords has been changed from 1 to 6, to replicate the behaviour of the original apg." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="v0.3.1: New password length behaviour To address issue #13, the password length behaviour of the original APG has been reproduced. Previously, when a minLength of 5 and a maxLength of 10 was given, apg-go se the pwLength to the preferred maxLength. With v0.3.1 it will choose a random length between minLength and maxLength instead, same as the original C-lang apg did. For this the minLength has been defaulted to a sane value of 12 (instead of the 8 of the original apg). The default for maxLength stayed at 20. Also the default number of generated passwords has been changed from 1 to 6, to replicate the behaviour of the original apg." />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<integration-enabled>true</integration-enabled>
|
||||
|
|
11
apg.go
11
apg.go
|
@ -8,8 +8,9 @@ import (
|
|||
)
|
||||
|
||||
// Constants
|
||||
const DefaultPwLenght int = 20
|
||||
const VersionString string = "0.3.0"
|
||||
const DefaultMinLenght int = 12
|
||||
const DefaultMaxLenght int = 20
|
||||
const VersionString string = "0.3.1"
|
||||
|
||||
type Config struct {
|
||||
minPassLen int
|
||||
|
@ -37,9 +38,9 @@ apg [-m <length>] [-x <length>] [-L] [-U] [-N] [-S] [-H] [-C]
|
|||
[-l] [-M mode] [-E char_string] [-n num_of_pass] [-v] [-h]
|
||||
|
||||
Options:
|
||||
-m LENGTH Minimum length of the password to be generated (Default: 20)
|
||||
-m LENGTH Minimum length of the password to be generated (Default: 12)
|
||||
-x LENGTH Maximum length of the password to be generated (Default: 20)
|
||||
-n NUMBER Amount of password to be generated (Default: 1)
|
||||
-n NUMBER Amount of password to be generated (Default: 6)
|
||||
-E CHARS List of characters to be excluded in the generated password
|
||||
-M [LUNSHClunshc] New style password parameters (upper case: on, lower case: off)
|
||||
-L Use lower case characters in passwords (Default: on)
|
||||
|
@ -69,11 +70,11 @@ func main() {
|
|||
}
|
||||
|
||||
// Set PW length and available characterset
|
||||
pwLength := getPwLengthFromParams(&config)
|
||||
charRange := getCharRange(&config)
|
||||
|
||||
// Generate passwords
|
||||
for i := 1; i <= config.numOfPass; i++ {
|
||||
pwLength := getPwLengthFromParams(&config)
|
||||
pwString, err := getRandChar(&charRange, pwLength)
|
||||
if err != nil {
|
||||
log.Fatalf("getRandChar returned an error: %q\n", err)
|
||||
|
|
Loading…
Reference in a new issue