Mercurial > hg > mlmmj
changeset 731:e29893b9f581
Make the random strings produced always the same length rather the
smaller random numbers producing shorter strings which could be
problematic
author | Ben Schmidt |
---|---|
date | Sat, 31 Jul 2010 00:26:30 +1000 |
parents | 793e5b2b28f2 |
children | b37f66e0852b |
files | ChangeLog src/strgen.c |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Jul 31 00:25:36 2010 +1000 +++ b/ChangeLog Sat Jul 31 00:26:30 2010 +1000 @@ -1,3 +1,6 @@ + o Makes the random strings produced always the same length rather the + smaller random numbers producing shorter strings which could be + problematic o Make random number generation more efficient by only seeding the generator once o Added feature to notify users when their posts are moderated
--- a/src/strgen.c Sat Jul 31 00:25:36 2010 +1000 +++ b/src/strgen.c Sat Jul 31 00:26:30 2010 +1000 @@ -40,10 +40,10 @@ char *random_str() { - size_t len = 128; + size_t len = 17; char *dest = mymalloc(len); - snprintf(dest, len, "%x%x", random_int(), random_int()); + snprintf(dest, len, "%08x%08x", random_int(), random_int()); return dest; }