logo
Tags down

shadow

Problems with if statement in a password generator


By : Orsi
Date : August 01 2020, 01:00 AM
I hope this helps . I am having problem with my if statement in my code: , The problem is on the password2.find, try using any:
code :
if choice == 'own':
    print("It must be more than 8 characters and should have atleast a lower case, upper case and aspecial character")
    password2 = input("Enter your password: ")
    if len(password2) < 8:
        print("Doesnt meeet the requirments (len)")
    elif not any(char in password2 for char in lower):
        print("Doesnt meeet the requirments (lower)")
    elif not any(char in password2 for char in upper):
        print("Doesnt meeet the requirments (upper)")
    elif not any(char in password2 for char in special):
        print("Doesnt meeet the requirments (special)")
    else:
        password = password2
        passcheck()
import string, random
lower = string.ascii_lowercase
upper = string.ascii_uppercase
special = '!"£$%^&*.,@#/?'

def rand_pass():
    p = []
    [p.append(random.choice(lower)) for x in range(4)]
    [p.append(random.choice(upper)) for x in range(4)]
    [p.append(random.choice(special)) for x in range(2)]
    random.shuffle(p)
    return "".join(p)


Share : facebook icon twitter icon

Which OTP (one-time password) algorithm do banks use on their password generator token?


By : nonnon
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , As aiodintsov said, the answer cannot be generalized but the choice of technology really depends upon the bank. My guess is TOTP. But let me give a reason on the choice.
TOTP removes the need for client and server to stay in sync on the event counter by using a Unix timestamp instead. The algorithm allows the server to choose how far off an incoming timestamp it deems acceptable, in order to correct for clock drift.

Python password generator that creates a new password on user input


By : Sarang Mahajan
Date : March 29 2020, 07:55 AM
Hope this helps You have to repeat the password generation, by putting everything into the while-loop, or better, write a function to generate one password and call this function inside the while-loop:
code :
import random

alphabet = "abcdefghijklmnopqrstuvwxyz"
pw_length = 6

def generate_password(pw_length):
    mypw = ""
    for i in range(pw_length):
        next_index = random.randrange(len(alphabet))
        mypw = mypw + alphabet[next_index]

    # replace 1 or 2 characters with a number
    for i in range(random.randrange(1,3)):
        replace_index = random.randrange(len(mypw)//2)
        mypw = mypw[0:replace_index] + str(random.randrange(10)) + 
    mypw[replace_index+1:]

    # replace 1 or 2 letters with an uppercase letter
    for i in range(random.randrange(1,3)):
        replace_index = random.randrange(len(mypw)//2,len(mypw))
        mypw = mypw[0:replace_index] + mypw[replace_index].upper() + 
    mypw[replace_index+1:]
    return mypw

while True:
    print("Your password is", generate_password(pw_length))
    inp = input()
    if not inp:
        break
import string
import random

def generate_password(pw_length):
    charsets = []
    # take 1 or 2 numbers
    for i in range(random.randrange(1,3)):
        charsets.append(string.digits)
    # take 1 or 2 uppercase
    for i in range(random.randrange(1,3)):
        charsets.append(string.ascii_uppercase)
    # fill up with lowercase up to pw_length
    while len(charsets) < pw_length:
        charsets.append(string.ascii_lowercase)
    # generate password of charsets
    random.shuffle(charsets)
    return ''.join(random.choice(cs) for cs in charsets)

while True:
    print("Your password is", generate_password(pw_length))
    inp = input()
    if not inp:
        break

Python password generator-no output for password array


By : aped
Date : March 29 2020, 07:55 AM
I wish did fix the issue. After running, and choosing password strength, there is nothing stored in "password". Also, is there a way to avoid making 5 if loops for each password_strength level? , This is the faulty line, cast your input to integer.
code :
user_choice = int(input("Enter desired password strength (1-5) : "))

How can I get value from user for click function using if statement for a password generator?


By : Mashvee
Date : March 29 2020, 07:55 AM
I wish this help you Please provide html part.
and when you click #generate, you didn't define the value of num variable.
code :
var num= $("#num").val();

Password Generator throws IndexOutOfBoundsException when password length is taken from scanner


By : user3620913
Date : March 29 2020, 07:55 AM
I wish this help you So I have made a random password Generator as homework for my Uni class, However i do have an issue with code breaking and exiting with "java.lang.IndexOutOfBoundsException : Invalid array range: 0 to 0" message once it gets to first itteration of loop in method that should generate my password. This is an updated version of code that implements scanner as option for user tu input his/her desired password lenght from keyboard. In previos version when password length was hardcoded as a set number, it worked allright. If there is anny mistake in question format or maybe the code looks ugly or whatever, I do apoligize beforehand as my coding skills are at the very bottom in my current stage.
code :
static int PasswordLength;
static char[] GeneratedCharacters= new char[PasswordLength];
    PasswordLength= PassLengthScanner.nextInt();
        GeneratedCharacters[i]=(RandomOne);
    Random TheGenerator= SecureRandom.getInstance("SHA1PRNG");
Related Posts Related Posts :
  • TypeError: __init__() missing 3 required positional arguments?
  • Python List assignment seems like it gets carried away
  • use grep or awk to split a column into multiple columns with the headers in the original file headers
  • Python - Render a Slanted Font
  • Why does Python believe return_value is a string?
  • How to hash sha256 many times in python
  • Pickle file not being written to properly
  • pip didn't install package from requirements.txt but did from command
  • Multiple Categorical Variables in a Column & The Prep
  • 'int' object is not callable when called method of instance class
  • Recursive Function conversion
  • In python, I'm trying to count each element in a list using a for loop, but it returns the element occurrence n many tim
  • Replace duplicates with first values in dataframe
  • Converting from Date-Time to GPS time
  • command line interface for background python process
  • I made this code to make a tic-tac-toe game without a GUI in PYTHON
  • Split multiple columns into new rows
  • SQL query join in Pandas
  • Python regex that match column with non-uniform space separation between any 2 column?
  • Python Tkinter and MySQL Error: AttributeError: 'NoneType' object has no attribute 'get'
  • Multiple if and for loop in list comprehension
  • Pandas: create a Dataframe from lists with similar-size lists inside
  • Python add quotes to comma-delimited string?
  • Pandas : create a list based on index of a Dataframe
  • Finding appropriate text
  • Compare two list with same length and remove by specific value
  • How do I subscript a boolean function in a data frame in Python?
  • My 'change password' function isn't working, and getting stuck in a loop instead
  • how to sort list in alphabetical order in python?
  • How to join multiple rows sequentially in a numpy array?
  • Sorting the columns based on value of a column. Pandas
  • regex with 'Named Capture Group' to catch a pattern or an alternate one
  • What's the underlying implimentation of integer division in python?
  • Can I make the output of a lambda function depend on conditionals without declaring a function to handle it?
  • Numpy 2d array: account for border elements when modifying neighbouring elements
  • Implementing SmoothL1Loss for specific case
  • Plot is not displaying when executing script
  • How to label every nth row of a pandas dataframe by an incremental value
  • Python list contains only digits integer or string
  • Python - Repeat the input options in console using input() until the user chooses to quit
  • Python : how to input put a random array
  • Find specific string and output the whole line Python
  • PySpark add a column with a name based on value
  • Creating a new list by multiplying each value in a list with the values of another list
  • Separating expression in chaining comparison operator python
  • Problems getting next page when scraping with scrapy
  • Call GraphQL API with String variable
  • Python-How to handle X display error in python exception
  • Find the last file name in python
  • Numba jitting changes result when adding certain kind of 0 to local variable
  • How to convert pixels stored in a list into an image with python?
  • All the possible combination and permutations with repetition on python
  • How to pass a CSV file to a Flask app running inside a Docker container?
  • Increment all entries in an array by 'n' without a for loop
  • invalid literal for int() with base 10 : '(1,2,3,4,5,6,7)'
  • 2d array as index of a 3d array
  • Generate sum of squares between 1 and 10 for polynomial graph
  • Define a variable for a ":" slice
  • Filter Django models based on date comparision
  • The following code is giving me an error: 'list' object has no attribute 'split'
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org