from abduct:
labatymo's solution is also correct, although contains a bunch of overhead via using string builds and such.
me and azrad were bouncing ideas off eachother on steam and we came to a solution that yeilds similar results for both python and ruby which are pretty fast for what this application does.
our first implementation was to convert the password to be incremented to and from ordinal and character values within the funcitons. this yeilded approx 350~ second runtimes for generating and checking vs a full keyset !!!! -> !!!~ which would be 213729 combinations per second.
we then decided to convert the password to be checked to an ordinal value array which never converts back to a char array, its only purpose is to be incremented. at the end of the function that increments the oridnal array it converts the ordinal array into a character string with one pase. this yeilded approx 145~ for !!!! -> !!!~ which was an increase to 515897 combinations per second
we next optimised our functions by reducing conditional statements and loops. this yeilded 116~ runtimes for !!!! -> !!!~ which was 644872 per second
we finally create a hash table of our total keyset we used so that the languages does not use a full keyset to check upon to convert ordinals to chars. this reduced it further to 95~ seconds for !!!! -> !!!~
with the final outcome we are able to produce 787k passwords/passwords checks a second, and if this is linear that would mean that a 6 length charset of !!!!!! -> !!!!!~ would take 228 hours lol
just some information that i think is kind of neat.
although this does not include sub keysets such as ! -> ~, !! -> !~, and !!! -> !!~ and is purely stats for the 4 length keyset
This post was edited by dolarsignzeroxeighty on Jun 6 2013 01:37pm