Last active
January 2, 2022 21:35
-
-
Save logankilpatrick/3825d60a86713534e4d8abf992dab7ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate Passwords in Julia | |
# Source: https://github.com/logankilpatrick/10-Julia-Projects-for-Beginners | |
using ProgressBars | |
using Random | |
# WARNING: Do not use this code to generate actual passwords! | |
function generate_passwords() | |
num_passwords = parse(Int64, Base.prompt("How many passwords do you want to generate?")) | |
password_length = parse(Int64, Base.prompt("How long should each password be?")) | |
# Create an empty vector / array | |
password_holder = [] | |
# Generate a progress bar to show how close we are to being done | |
for i in ProgressBar(1:num_passwords) | |
# Add the new password into the password holder | |
push!(password_holder, randstring(password_length)) | |
sleep(0.2) # Manually slowdown the generation of passwords | |
end | |
# Only show the passwords if there are less than 100 | |
if length(password_holder) <= 100 | |
# Loop through each password one by one | |
for password in password_holder | |
print("\n", password) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment