match.go 678 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package match
  2. type Matches []Match
  3. func (s Matches) Len() int {
  4. return len(s)
  5. }
  6. func (s Matches) Swap(i, j int) {
  7. s[i], s[j] = s[j], s[i]
  8. }
  9. func (s Matches) Less(i, j int) bool {
  10. if s[i].I < s[j].I {
  11. return true
  12. } else if s[i].I == s[j].I {
  13. return s[i].J < s[j].J
  14. } else {
  15. return false
  16. }
  17. }
  18. type Match struct {
  19. Pattern string
  20. I, J int
  21. Token string
  22. DictionaryName string
  23. Entropy float64
  24. }
  25. type DateMatch struct {
  26. Pattern string
  27. I, J int
  28. Token string
  29. Separator string
  30. Day, Month, Year int64
  31. }
  32. type Matcher struct {
  33. MatchingFunc func(password string) []Match
  34. ID string
  35. }