Skip to content

easy password generator #576

Description

@artemkiselevit

import string, random
def generate_password(length=8):
chars = string.ascii_letters + string.digits + string.punctuation
return ''.join(random.choice(chars) for _ in range(length))
print(f"Пароль: {generate_password(10)}")

Activity

  1. Ix3WUhpgTPE commented on Jun 6, 2026

    @Ix3WUhpgTPE

    It might also be worthwhile to implement a mechanism that adjusts the character set based on the specified length. For instance, if the user requests a password length of less than 8 but still wants complexity, we could limit the character set to alphanumeric only or even just lowercase letters. This could help maintain a balance between security and usability, especially for shorter passwords. Would this type of dynamic adjustment be something you'd want to include?

  2. yashrajgroupoffice commented on Aug 6, 2026

    @yashrajgroupoffice

    Reducing the character set (such as restricting short passwords to alphanumeric or lowercase only) actually makes short passwords much less secure. Short passwords already have low entropy, so limiting the pool of characters significantly reduces the search space for brute-force attacks.

    Instead, short passwords need more complexity, not less. A better approach is:

    1. Require a minimum password length (e.g., at least 8 or 12 characters).
    2. Ensure at least one character from each required category (uppercase, lowercase, digits, special characters) is guaranteed.
    3. Use the secrets module instead of random for cryptographically secure random generation.
  3. haitao888 commented on Aug 6, 2026

    @haitao888
  4. suner8676-eng commented on Aug 26, 2026

    @suner8676-eng

    generate_password function to allow users to specify the desired complexity, with flags for including/excluding digits and punctuation. This would provide more flexibility for users who may have varying security requirements or restrictions

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions