Simple Password Generator. Finally, a channel I can relate to... well, that and Whose Line, of course. Uploaded for and giggles. Just a simple private project I fuck da police
Upload
Login or register

Simple Password Generator

Click to block a category:GamingPoliticsNewsComicsAnimeOther
 
Simple Password Generator. Finally, a channel I can relate to... well, that and Whose Line, of course. Uploaded for and giggles. Just a simple private project I

Finally, a channel I can relate to... well, that and Whose Line, of course.

Uploaded for ***** and giggles. Just a simple private project I was working on. I'd like to eventually mix whole words into these options.

Code written and compiled by me.

It' s been awhile since I last uploaded anything.
Thankfully, there' s this geek' s channel, and being a
geek myself, why not use this as a sad excuse to show
off a simple password generator I made in Cer
E sasage,.
mama:
maca-
gnc) . nuee
2 using namespace std.‘
Global Constant:
ll nu: an
12 Conn: Ln: Hm
13 count: TDC :
15 // Prototype:
is mad passback_ " ICIC I; , cons: was aasham:
20 'equest
if Says aw
5 using namespace std.‘
5 (max passback_ ;
16 1: 1: Banana:
2 do
22 case 2
an case a;
an case
passback_ starr);
false:
as case
37 break
as default:
45 - false:
42 --Rozele
44 return J;
54 aunt.
5: 3x315]
escher'
return.‘
vaak pre: ( gnc 5
was
can " annus:
return:
was: passback_ ' " an I; , count was
anc cam. defined.‘
was Fl
Inbe: at
can " aerate
5.: 55555
catsuit_ ;
return.‘
And now for the execution of the program
asaen I.
e u/ onhan: -A characters (2, S.
was
Hello. 555 5515555 ' mp, Passwurd Lizard a.
315555555. 5 m 555. 5555 char 55... (- a
Qun
555555 5; characters. 22
e u/ onhan: -A characters (2, S.
was
was» Dasbeard . PGUP] Kqp
Hello. 555 5515555 ' mp, Passwurd Lizard a.
315555555. 5 m 555. 5555 char 55... (- a
Enter number a? characters. IE
7222572455
Numer .
Compiled and ran using , a standalone C/ Java
compiler for Windows using standard UNIX commands.
Code written in Notepaper
Constructive feedback is appreciated.
If this confused anyone, here' s a bunny for the trouble.
Why?
Because cats are overrated.
...
+26
Views: 2161 Submitted: 07/27/2012
Hide Comments
Leave a comment Refresh Comments (26)
> hey anon, wanna give your opinion?
asd
#19 - SwiftNinja
Reply +4 123456789123345869
(07/28/2012) [-]
Or instead of using code, you can smash the keyboard with your fist to generate passwords.

fdsylxbn
[oijnkdzo
lkhbzdsvs
mf8h0[9j3g
9vmnf873tn
90uh04b
uin4397b
User avatar #3 - rustyrabbit
Reply +3 123456789123345869
(07/27/2012) [-]
You could have saved lots of typing and lines of code by just using loop(s) to fill your ascii array.

for (int i = (int) 'a'; i <= (int) 'z'; i++)
{
ascii[ i - (int) 'a']
}

that example should fill your ascii array with:

[0] = a
[1] = b
[2] = c
...
...
...
[25] = y
[26] = z



Haven't tested it though :P
User avatar #4 to #3 - rustyrabbit
Reply 0 123456789123345869
(07/27/2012) [-]
If you want to include all alphanumeric and special characters (might be unsuitable for passwords that don't accept slashes, spaces etc):

for (int i = 32; i <= 126; i++)
{
ascii[ i - 32] = (char) i;
}
User avatar #5 to #3 - rustyrabbit
Reply 0 123456789123345869
(07/27/2012) [-]
forgot to mention what we're putting into the array lol

ascii[ i - (int) 'a'] = (char) i;
#6 to #3 - valetparking [OP]
Reply 0 123456789123345869
(07/27/2012) [-]
i think i tried that, but it didn't quite work out the way i wanted it to - numbers and/or letters appearing where they shouldn't and stuff like that. i'll see if i can improve on that for next time. thank you for the advice.

here's a lemon grenade in case you get mad :D
#9 to #6 - rustyrabbit
Reply 0 123456789123345869
(07/27/2012) [-]
Screenshot's not working on Ubuntu :(



Well anyway here's proof
User avatar #10 to #9 - valetparking [OP]
Reply 0 123456789123345869
(07/27/2012) [-]
alright then, i'll keep that in mind next time. :D
User avatar #12 to #10 - rustyrabbit
Reply 0 123456789123345869
(07/28/2012) [-]
Actually, there's not need for the casting and because it's only one line we can remove the {}

for (int i='a'; i <='z'; i++)
ascii[ i-'a'] = i;

much simpler :D
#8 to #6 - rustyrabbit
0 123456789123345869
has deleted their comment [-]
User avatar #13 - nildnas
Reply +1 123456789123345869
(07/28/2012) [-]
People really need to document your programs. This one was pretty easy to follow, but you should be in the habit of writing comments. It would really help people who don't understand coding follow the program.
With that aside, nice job. I think it would have been a little easier to have all that array code in a for loop, and increment an ascii value each time. I think there is a function you can import to convert from ascii to alphanumeric. If I'm wrong, then for a small program like this, you went about it correctly.
User avatar #14 to #13 - valetparking [OP]
Reply 0 123456789123345869
(07/28/2012) [-]
yeah, i know, i tend to leave out code comments when doing my own programs simply because i usually keep it all in-house. got docked a few times in class because of it, but i never really got the hang of it.

as i stated to rustyrabbit (below), i remember trying to use a for loop but couldn't quite get the logic properly written, and i ended up having a few bad characters when executing the code. hard-writing my own array was the best i could do at the time, but thanks to the (surprisingly) helpful crew at FJ i learned a few more tricks.
User avatar #16 to #14 - nildnas
Reply 0 123456789123345869
(07/28/2012) [-]
The guy I was working with programming didn't comment anything. We were working on stuff that I was learning how to use as I went, so I forced him to comment in his code so I could learn what he was doing, and actually help him out. When I write something up for my self, I don't comment either.
User avatar #1 - rshowat
Reply 0 123456789123345869
(07/27/2012) [-]
Would you be willing to upload and share? Would love to expand on this.
User avatar #7 to #1 - valetparking [OP]
Reply +1 123456789123345869
(07/27/2012) [-]
if i can get the same code for Java, i'd like to release it (or a more enhanced version thereof) as an app for Android phones and maybe earn some much-needed cash. for now, though, this is simply a proof-of-concept.
#28 - anon id: c55a0d1f
Reply 0 123456789123345869
(07/28/2012) [-]
dude i'm majoring in computer science and that's honestly the most "ugly" piece of code i've ever seen
#30 to #28 - anon id: ef9ccc61
Reply 0 123456789123345869
(07/29/2012) [-]
i just scrolled down and cried at the about 70 lines from the array
User avatar #23 - hillaryisacunt
Reply 0 123456789123345869
(07/28/2012) [-]
A few more things i noticed from a quick look

> as you're using C++ , and not C , try using strings .

> string ascii = "01234567..... ( you get the idea ) , does the exact same thing

> you used switch case when you're supposed to use if else ( main() ) , and if else when you should use switch case ( password_genertor() )

> you're using return ; in void functions at the end , which is pointless . The only reason to use return in a void function is to return from the function conditionally ( i.e inside if else ) without running the rest of the function...not at the end

> you used a "pass by reference" ( presentMenu ) where a integer returning function makes more sense

> #include is almost same as copy-paste so , as you can see you included headers such as <iostream> twice , once each in header and source . Only reason you didn't get errors were because of the include guards inside those headers .
#25 to #23 - valetparking [OP]
Reply 0 123456789123345869
(07/28/2012) [-]
>i found real arrays easier to use, and strings are a lie (no joke; my programming teacher told us that)
>switch-case, as i was taught, was good to use for menus, but now that i see it it would actually make more sense in this case.
>i was told to type "return" at the end of my functions, and i got into that habit. i'll see if that actually works... not that i'm doubting you, of course.
>either way would've done the exact same thing. the only difference is fewer characters for the return
>i was told to make sure to " #include " what i needed for everything that was to be compiled. i take it just putting everything inside the header would do everything for the rest of the program (ex: have everything be #include-ed inside the header)?

and with regards to your earlier comment, yes, this was just for learning and personal purposes. i'd like to improve this code later on, and thus my reason to release this code to FJ. if/when i do learn how to use the cryptography api (as i am primarily a Windows user), i'll be sure to use that.

at any rate, thanks for the advice. here's a cake i got for you the other day
User avatar #26 to #25 - hillaryisacunt
Reply -1 123456789123345869
(07/28/2012) [-]
You're welcome and though your reply didn't warrant another reply , i thought I should mention

If you keep using char[] , though I don't understand what advantage you perceive , be very careful as small mistakes can produce hard to trace memory errors . Also most standard c++ functions work with strings .

As for the passing pointer vs return thing , it's not always about " does it work " . In the above context , it is not only unwarranted , but also cryptic . This kind of thing easily gets noticed when you're being screened for jobs as "just works" programmers are a dime a dozen .
User avatar #27 to #26 - valetparking [OP]
Reply 0 123456789123345869
(07/28/2012) [-]
yes, i'm aware of "walking off the array", as i have seen exactly what happens (unhandled exceptions causing a force-close, and even a kernel panic from one of my college buddies). i'll definitely try to keep strings in mind next time.
User avatar #22 - hillaryisacunt
Reply 0 123456789123345869
(07/28/2012) [-]
If I remember correctly , you're really not supposed to use rand() for generating passwords ( psudo-random , thus not safe ) .

This is probably just for leaning purposes , so it's fine . But if you ever do serious work , this is no good .

I'm using linux , so I just read from /dev/random .
Windows doesn't have /dev/random , but it does have a cryptography api , which is the standard way to do this ( though i've never personally used ) .
User avatar #31 to #22 - PlasmaFace
Reply 0 123456789123345869
(03/12/2013) [-]
He uses srand(time(NULL)) which gets the seed from the current time. Pretty much guaranteed a random combination. rand() on it's own is useless.
#21 - bahjy
Reply 0 123456789123345869
(07/28/2012) [-]
Grats Grats Grats
I recommend using Java much easier than Objective-C / C++
#18 - Spikeydeath
Reply 0 123456789123345869
(07/28/2012) [-]
how can i learn code?
User avatar #20 to #18 - lunascape
Reply 0 123456789123345869
(07/28/2012) [-]
#29 to #20 - Spikeydeath
Reply 0 123456789123345869
(07/28/2012) [-]
thanks man