Skip to content

fix: alternative_password_generator respects requested length - #15719

Open
dbdefault wants to merge 1 commit into
TheAlgorithms:masterfrom
dbdefault:fix/15633/password-generator-length
Open

dbdefault wants to merge 1 commit into
TheAlgorithms:masterfrom
dbdefault:fix/15633/password-generator-length

Conversation

@dbdefault

Copy link
Copy Markdown

Fixes #15633

Describe your change

  • �lternative_password_generator now raises ValueError when the requested
    length i is smaller than len(chars_incl), instead of silently returning
    a longer password.
  • Added doctests covering valid and invalid inputs.

Checklist

  • I have read the contributing guidelines
  • I have run
    uff check and
    uff format on my changes
  • I have added doctests for any new or changed functions
  • My change is one algorithm file

Fixes #15633

Guard against i < len(chars_incl) so the returned password never exceeds
the requested length. Add doctests covering valid and invalid inputs.

Fixes TheAlgorithms#15633

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

other/password.py: alternative_password_generator ignores the requested length when the required characters exceed it

1 participant