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 :
  • How can I assign varaibles to json response?
  • name 'df' is not defined in box plot
  • Comparing dataframe columns
  • Can I Override Global Authentication for a Single Request Type in an ApiView using DRF?
  • Celery chain performances
  • Why am I getting "asynchronous comprehension outside of an asynchronous function"?
  • Creating a file from a docker container
  • doing too many write operations in django rest framework and postgres
  • How to change the order of bar charts in Python?
  • Pandas Data Frame manipulation
  • an undefined error in a simple python code- KeyError: '284882215'
  • Pandas split column in several columns throug string replacement or regex
  • how value is passed from __init__ method in pyhton as it dose not return anyhting
  • Dynamically inherit all Python magic methods from an instance attribute
  • Asking user to input certain information
  • how to test a deep learning model in a new dataset
  • Is np.fft.fft working properly? I am getting very large frequency values
  • How can you delete similar characters at the same positions in 2 strings
  • Does insert (at the end of a list) have O(1) time complexity?
  • Automatically Creating List of Dictionaries Based Upon Two Lists of Equal Length with Python
  • Discrete Cosine Transform (DCT) Coefficient Distribution
  • multiprocessing.Pool not running on last element of iterable
  • Python: sorting string non lexicographically
  • Render images from media directory Django
  • Cannot understand why more vectorization is slower than less vectorization in this case?
  • Django - Use a property as a foreign key
  • creating a function that loops if you do not enter the correct variables
  • Confused on how to store 3D matrices in HDF5 file in matlab?
  • TOTP: Can someone use the same otp within 30s and misuse it
  • is it possible to have 2 type hints for 1 parameter in Python?
  • Can someone explain what this Numpy array property is called?
  • Better way to add the result of apply (multiple outputs) to an existing DataFrame with column names
  • Selecting choice numbers
  • Create variables from list PYTHON
  • This code takes forever to run but doesn't give an error
  • "return" and "return None" behavior difference in generator
  • AttributeError: 'str' object has no attribute 'fbind' error using kivy in Python
  • Python not importing files when not inside conda environment
  • Is it possible to override a class' __call__ method?
  • Python library for live coordinated plotting in map
  • Pandas: counting consecutive rows with condition
  • How to define that a return type of method is an implementation of superclass
  • How can I print to the Visual Studio Code console in Portuguese?
  • Google Appengine Standard Python 2.7: Can't run Google Endpoints on localhost dev_appserver.py anymore
  • google appengine Unauthorized status 401
  • Don't understand cause of this IndentationError in my tic tac toe script
  • How to read in key-value pair from a json file as a pandas dataframe?
  • Can decorator decorate a recursive function?
  • How do I create a nested for loop where I have control of the initial loop index value
  • Unexpected error when creating a SQLite database using python
  • Pythonic way to write cascading of loops and if statements?
  • Python Beginner - Having trouble with multiple choice quiz program
  • Itertools return value NOT used in combinations
  • Return a list of words that contain a letter
  • From rows to columns using Peewee ORM
  • Parse large text document, to keep only "account number", and a specific keyword ("Market Value")
  • Cannot append to my list without getting a nonetype object error
  • Python Train Test Split
  • Optimizing following Python List of Dictionary operation with better solution
  • In Pandas merge colum1 value with colum2, both col data type is object and only few values are null in first column?
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org