How to make a simple password program




















Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search. I am trying to create a program that asks the user to enter a password with a condition of at least 10 letter characters with at least 2 numbers. So far this is what I've come up with, but the program reads any amount of letters or numbers as a valid password.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to make a password program Ask Question. Asked 4 years, 1 month ago.

Active 4 years, 1 month ago. Viewed 3k times. Improve this question. Evani Evani 1 1 1 silver badge 1 1 bronze badge. Add a comment. Active Oldest Votes. People here are free to copy my code and modify it according to their needs, if they want to enhance security by using hashed passwords, that's okay.

Hey nice password program. I did not tried this before. How can I? Thanks for the above program now i am safe with my programs thank you very much for the owner if you need any help contact me I'm sorry that i revive this topic but i have a problem with this code! Now if i type the password correctly for the first time it works, but if i typed wrong then correct it sais that the password is wrong.

I've been able to make it work by making it into a function then accesing it from main with a loop. There's no standard way to simulate getch. Pick your favorite non-standard option to replace it. What it does it is prints a backspace character to the screen, thus moving the text cursor to the left one place. Then it prints a space, clearing whatever character was there before, and then prints another backspace character.

It effectively means that whatever character was typed on the screen is removed from sight. Yeah anytime you encourage newbie programmers to use some code you should mention any security risks you're aware of.

You should do that at the same time that you introduce the code. As you already discussed in earlier comments so I know you understand this, mvmalderen , this part assumes the program knows the actual password:. Any program handling passwords should never remember actual passwords. Instead they should remember a transformation of the password that cannot be reversed. Then anytime a user types their password, you do the same transformation on their input and compare that to what you have stored.

I've never implemented password storage so I don't know the specifics, but this seems like a good article to learn more:. Paying special attention to the quote from the cryptogtapher and the list of 4 things at the end. But I wouldn't take this single source as gospel either.

Do some research. We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.

You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed.

It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.

If you want real security it needs to be encrypted using sha1 or some other scheme. Using hashing, you'll have to do something like this in general: Get the hashed password. Get the user entered password. Hash the password entered by the user and compare it to the hashed correct password. If the comparison yields true, then log the user in.

It help but you must include header file ctype. Edited 10 Years Ago by Narue because: Removed personal information. Reformat your code so we can tell wht statements go with what DO loop. Thank you!! You've helped me so much!



0コメント

  • 1000 / 1000