Scroll to navigation

Data::Password::zxcvbn::Match::Spatial(3pm) User Contributed Perl Documentation Data::Password::zxcvbn::Match::Spatial(3pm)


Data::Password::zxcvbn::Match::Spatial - match class for sequences of nearby keys


version 1.1.2


This class represents the guess that a certain substring of a password can be obtained by moving a finger in a continuous line on a keyboard.



The name of the keyboard / adjacency graph used for this match


Hashref, spatial information about the graph:

  • "starting_positions"

    the number of keys in the keyboard, or starting nodes in the graph

  • "average_degree"

    the average number of neighbouring keys, or average out-degree of the graph


How many of the keys need to be "shifted" to produce the token


How many times the finger must have changed direction to produce the token



The number of guesses grows super-linearly with the length of the pattern, the number of "turns", and the amount of shifted keys.


  my @matches = @{ Data::Password::zxcvbn::Match::Spatial->make(
    { # this is the default
      graphs => \%Data::Password::zxcvbn::AdjacencyGraph::graphs,
  ) };

Scans the $password for substrings that can be produced by typing on the keyboards described by the "graphs".

The data structure needed for "graphs" is a bit complicated; look at the "build-keyboard-adjacency-graphs" script in the distribution's repository <>.



This class suggests that short keyboard patterns are easy to guess, and to use longer and less straight ones.


The JSON serialisation for matches of this class will contain "token i j guesses guesses_log10 graph_name shifted_count turns".


Gianni Ceccarelli <>


This software is copyright (c) 2022 by BroadBean UK, a CareerBuilder Company.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2023-04-04 perl v5.36.0