|
Message-ID: <CACYkhxhbpyE5XKDpDYZNK3q2+FK2=GxsO5L+6KBqotiHUBxVow@mail.gmail.com> Date: Tue, 11 Jun 2013 19:56:45 +1000 From: Michael Samuel <mik@...net.net> To: john-users@...ts.openwall.com Subject: Re: Extra functions/datatypes for external mode? Ok, so I just made a mapping of the points in which the number changes - not pretty, but accurate :) Are functions completely off-limits in external mode (eg. even for use within the same external generator)? On 10 June 2013 09:12, Michael Samuel <mik@...net.net> wrote: > On 10 June 2013 02:39, Solar Designer <solar@...nwall.com> wrote: > >> Can you post the relevant excerpt from your C code (along with the >> relevant variable declarations)? Did the original password generator >> use the "double" data type too? >> >> The original used the dot-net System.Random library, which expands the > entropy out > with this trick: > > int32_t Random_Sample(random_state_t* state); > > double Random_NextDouble(random_state_t* state) > { > return ((double)Random_Sample(state)) * 4.6566128752457969E-10; /* > Reciprocal of 2^31 */ > } > > int Random_NextInt(random_state_t* state, int maxValue) > { > assert(maxValue >= 0); > return (int)(Random_NextDouble(state) * (double)maxValue); > } > > I think that in your case it'd be best to go with emulating the one >> conversion via "double" in 32-bit integer arithmetic in an external >> mode, if having to implement that conversion is not easily avoidable. >> > > I have code now that works well with john --stdin - so I guess I'm happy > to leave it at that. Also, since I'm only asking for random integers of > sizes 4, 10, 26 and 32 - I could just make a table of answers. > >
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.