How can I programmatically create / detect runs in passwords?

I am looking for a method to create a list or detect spaces in a password.

I can associate my problem with password criteria such as length and number of special characters.

An example of a simple key start can be "6yhn ^ YHN" or "zse4ZSE $".

More complex key runs can take many forms, for example, “V” or “X” (for example, “mko0mju7MKO) MJU &”)

The initial idea was to do a statistical analysis of large password dumps and monitor the distribution of key passwords only for launch, but I think it can have positive applications in password security tools.

+6
source share
3 answers

I don’t see how this relates to regex - do you think you can do it with regexes? I do not see how.

I think this is a graphics problem, no? Create a graph with all the edges between the keys and their neighbors, and then cross the entrance and see if it is a real graph traversal. Your "more complicated runs" essentially just backtrack - if the next key on the input is not an edge on your chart, go back to the beginning (or maybe step back one by one if you want to cover the "T" or other options?) And see can you keep moving ...

This is a rather vague answer to a rather vague question, isn't it?

+3
source

You will not do this with regex.

You will need to create a graph data structure that simulates the keyboard, with each key having a node and a direction assigned to the edges (so node G will have an edge with a direction to the right and destination H). You may also have an edge going from the key to it to the shifted version (or from shifted to unmoved). Then you can check the start in the password, indicating that it matches the graph in the sequential direction for N characters.

There are a lot of possible launches on the keyboard, so I'm not sure that a password consisting of runs is less secure than other possible passwords ...

+4
source

Actually, probably it would not be so difficult. Store a collection of objects that represent characters with their properties, such as TL, BR, T, BL (upper left, lower right, upper, lower left), for example:

a = RunKey.get("A"); public class RunKey{ public static Key get(Character char){ switch(char){ case A,a: return new A(); break; // one for every letter } } } private class A extends RunKey implements IRunKey{ public IRunKey BR(){ return new Z(); } public IRunKey TR(){ return new W(); } public IRunKey T(){ return new Q(); } public Direction getDirection(Character char){ tempRunKey = Runkey.get(char); if (tempRunKey.T.toString == "char"){ return T; } } } 

I began to go crazy creating the “Direction” interface, so it’s a bit more complicated than at the beginning, but you only have so many complications and relatively simple objects, so if you save it, it will probably remain pretty fast.

I feel like a dynamic language might be the best for something like that ...

And yes, as other answers note, regex won't work.

0
source

Source: https://habr.com/ru/post/892621/


All Articles