Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: third_party/fips181/randpass.cc

Issue 308503002: [Password Generation] Start using pronouncable passwords (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unnecessary includes Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/fips181/randpass.h ('k') | third_party/fips181/smbl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/fips181/randpass.cc
diff --git a/third_party/fips181/randpass.cc b/third_party/fips181/randpass.cc
index b804365ac26dcec2e03a26a60653784ee28a1fdd..8aded1529362b0c08e71c4cb53724ba5b3e33c5f 100644
--- a/third_party/fips181/randpass.cc
+++ b/third_party/fips181/randpass.cc
@@ -34,13 +34,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#if !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32) && !defined(__WIN32__)
-#include <pwd.h>
-#endif
-#include <unistd.h>
-#include "randpass.h"
+#include "base/rand_util.h"
#include "owntypes.h"
+#include "randpass.h"
#include "smbl.h"
/*
@@ -69,8 +66,8 @@ gen_rand_pass (char *password_string, int minl, int maxl, unsigned int pass_mode
if (minl > APG_MAX_PASSWORD_LENGTH || maxl > APG_MAX_PASSWORD_LENGTH ||
minl < 1 || maxl < 1 || minl > maxl)
return (-1);
- for (i = 0; i <= 93; i++) random_weight[i] = 0;
- length = minl + randint(maxl-minl+1);
+ for (i = 0; i <= 93; i++) random_weight[i] = 0;
+ length = base::RandInt(minl, maxl);
str_pointer = password_string;
for (i = 0; i < length; i++)
@@ -79,7 +76,7 @@ gen_rand_pass (char *password_string, int minl, int maxl, unsigned int pass_mode
for (j = 0; j <= 93 ; j++)
if ( ( (pass_mode & smbl[j].type) > 0) &&
!( (S_RS & smbl[j].type) > 0))
- random_weight[j] = 1 + randint(20000);
+ random_weight[j] = base::RandInt(1, 20000);
j = 0;
/* Find an element with maximum weight */
for (j = 0; j <= 93; j++)
@@ -125,7 +122,7 @@ gen_rand_symbol (char *symbol, unsigned int mode)
for (j = 0; j <= 93 ; j++)
if ( ( (mode & smbl[j].type) > 0) &&
!( (S_RS & smbl[j].type) > 0))
- random_weight[j] = 1 + randint(20000);
+ random_weight[j] = base::RandInt(1, 20000);
j = 0;
/* Find an element with maximum weight */
for (j = 0; j <= 93; j++)
« no previous file with comments | « third_party/fips181/randpass.h ('k') | third_party/fips181/smbl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698