Search match search signatures by md5 in file collections
(files []string, searchTerm string)
| 52 | |
| 53 | // Search match search signatures by md5 in file collections |
| 54 | func (*Md5Matcher) Search(files []string, searchTerm string) ([]*Result, error) { |
| 55 | res := make([]*Result, 0) |
| 56 | for i, v := range files { |
| 57 | if md5, err := Md5(v); err != nil { |
| 58 | return nil, err |
| 59 | } else { |
| 60 | if md5 == searchTerm { |
| 61 | res = append(res, &Result{ |
| 62 | Index: i + 1, |
| 63 | Path: v, |
| 64 | Code: md5, |
| 65 | }) |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | return res, nil |
| 70 | } |
| 71 | |
| 72 | // Search match search signatures by hex in file collections |
| 73 | func (*HexMatcher) Search(files []string, searchTerm string) ([]*Result, error) { |