diff options
author | Christian Cleberg <hello@cleberg.net> | 2025-04-04 22:32:42 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2025-04-04 22:32:42 -0500 |
commit | d5f657283bc7de525661f3a967e5d6fb213763d2 (patch) | |
tree | 118a7d02ce108cefada2b0b8d514cf47839ccddd | |
parent | a7bf2c602b2b186a9924db173a75572d09c1edcd (diff) | |
download | yoshi-cli-d5f657283bc7de525661f3a967e5d6fb213763d2.tar.gz yoshi-cli-d5f657283bc7de525661f3a967e5d6fb213763d2.tar.bz2 yoshi-cli-d5f657283bc7de525661f3a967e5d6fb213763d2.zip |
fix: replace random.choice with secrets.choice
-rw-r--r-- | yoshi/process.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/yoshi/process.py b/yoshi/process.py index dabce86..f09c036 100644 --- a/yoshi/process.py +++ b/yoshi/process.py @@ -25,6 +25,7 @@ Usage: from string import ascii_letters, punctuation, digits import random +import secrets import uuid from prettytable import PrettyTable from yoshi.account import Account @@ -45,7 +46,7 @@ def generate_characters(n: int) -> list: characters = [] password_format = ascii_letters + punctuation + digits for _ in range(n): - characters.append(random.choice(password_format)) + characters.append(secrets.choice(password_format)) return characters @@ -76,9 +77,9 @@ def generate_passphrase(n: int, sep: str) -> str: str: A string representation of the passphrase """ phrases = [] - lucky_number = random.choice(range(0, n)) + lucky_number = secrets.choice(range(0, n)) for _ in range(n): - word = random.choice(WORDLIST) + word = secrets.choice(WORDLIST) if _ == lucky_number: phrases.append(word.capitalize() + str(_)) else: |