aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nbutton23/zxcvbn-go/match
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-04 11:12:55 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-04 15:05:30 +0200
commitc7d7f10bdff703e4a3c0414e8a33d4e45c91eb35 (patch)
tree0dff0ee1f98dbfa3ad8776112053a450d176592b /vendor/github.com/nbutton23/zxcvbn-go/match
parent9573094ce235bd9afe88f5da27a47dd6bcc1e13b (diff)
go.mod: vendor golangci-lint
Diffstat (limited to 'vendor/github.com/nbutton23/zxcvbn-go/match')
-rw-r--r--vendor/github.com/nbutton23/zxcvbn-go/match/match.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/github.com/nbutton23/zxcvbn-go/match/match.go b/vendor/github.com/nbutton23/zxcvbn-go/match/match.go
new file mode 100644
index 000000000..dd30bea04
--- /dev/null
+++ b/vendor/github.com/nbutton23/zxcvbn-go/match/match.go
@@ -0,0 +1,44 @@
+package match
+
+//Matches is an alies for []Match used for sorting
+type Matches []Match
+
+func (s Matches) Len() int {
+ return len(s)
+}
+func (s Matches) Swap(i, j int) {
+ s[i], s[j] = s[j], s[i]
+}
+func (s Matches) Less(i, j int) bool {
+ if s[i].I < s[j].I {
+ return true
+ } else if s[i].I == s[j].I {
+ return s[i].J < s[j].J
+ } else {
+ return false
+ }
+}
+
+// Match represents different matches
+type Match struct {
+ Pattern string
+ I, J int
+ Token string
+ DictionaryName string
+ Entropy float64
+}
+
+//DateMatch is specifilly a match for type date
+type DateMatch struct {
+ Pattern string
+ I, J int
+ Token string
+ Separator string
+ Day, Month, Year int64
+}
+
+//Matcher are a func and ID that can be used to match different passwords
+type Matcher struct {
+ MatchingFunc func(password string) []Match
+ ID string
+}