fertzombie.blogg.se

Simple strong password generator
Simple strong password generator





  1. #Simple strong password generator generator
  2. #Simple strong password generator portable
  3. #Simple strong password generator code

It's secure, since I expect people to use this for passwords or other security tokens.Generating an 8 character string (~47 bits of entropy) is meaningless if your PRNG only generates 2 billion (31 bits of entropy) different values. It outputs more than a few billion strings for each argument set.The distribution of strings is almost uniform (don't care about minor deviations, as long as they're small).

#Simple strong password generator generator

Or far better, use a random number generator with a far longer period and initialization state. Get first triple digit, LETTER, letter printf("Press enter to get a twelve-character password\n") This is a deep subject, so only starting with some basic ideas such as using a new random initial value for each triple.

#Simple strong password generator code

Urandom_fd = open("/dev/urandom", O_RDONLY) Įven this is not so great as your code will only generate about UINT_MAX different passwords instead of pow(10*26*26,4). Srand(delta ^ time ^ pid) // ^ is OK and simple, other better mixing methods exist. Unsigned int pid = (unsigned int) getpid(void) Unsigned int time = (unsigned int) time(NULL) Unsigned int delta = (unsigned int) (clock() - start) Srand((unsigned int)(time(NULL))) is weak, as if one knows the code and about the time used, others can guess the password generated to within a few hundred/thousand combinations. When using passwords, good to scrub buffers: a small step to avoid memory dumps harvesting information. static const char lower_az = "abcdefghijklmnopqrstuvwxyz" Ĭhar lower_letter = lower_az

#Simple strong password generator portable

Pedantic: Using this method with letters would make code more portable to more machines as 'a' to 'z' may not be consecutive. static const char punct_set = punct = punct_set To use punctuation, simply select from an array. I want to make it more efficient if I can, and perhaps add some punctuation, which does not seem that easy, since the ASCII codes are quite spread out All you need to do is just put in all the permissible characters in the string and you are bound to get a randomly generated password :) I'd say generating the password is much more advantageous as you can only randomly select from the characters that provide in the string. you can add all the additional punctuations which are required I just added a few punctuations characters for explanatory purpose Int main(void) //int main() is not a valid signature in CĬhar pass //extra byte for null terminating characterĬhar characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/.-+=~`:" let me explainĬonsider the following for loop in your code: for (i = 0 i Though you are getting desired output, here in your code you are not exactly generating characters at all indices/positions of the char pass array. Like I said, I want to make it more efficient if I can, and perhaps add some punctuation, which does not seem that easy, since the ASCII codes are quite spread out. I can generate decent passwords, such as: 7Qb4Le2Id0Ss, 1Sw0Nb2Ky1Zp, 0Am3Wa4Wo1Tm and 4Rr4My1Mt1Gj. Printf("Press enter to get a twelve-character password\n") This is my code, I've aimed to make it as simple as possible: #include I've noticed a lot of the password generators people have shown on this are written in Java and maybe Python or C# so hopefully mine will add some variety. It's quite useful for when I'm making a new account and need to make up a quick password on the spot. I decided to write a console program that can generate a random alphanumerical password in the C language.







Simple strong password generator