-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathexample_test.go
More file actions
53 lines (46 loc) · 790 Bytes
/
example_test.go
File metadata and controls
53 lines (46 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package ssdeep_test
import (
"bytes"
"fmt"
"log"
"math/rand"
"os"
"github.com/glaslos/ssdeep"
)
func ExampleFuzzyFile() {
f, err := os.Open("file.txt")
if err != nil {
log.Fatal(err)
}
defer f.Close()
h, err := ssdeep.FuzzyFile(f)
if err != nil {
log.Fatal(err)
}
fmt.Println(h)
}
func ExampleFuzzyBytes() {
buffer := make([]byte, 4097)
rand.Read(buffer)
h, err := ssdeep.FuzzyBytes(buffer)
if err != nil {
log.Fatal(err)
}
fmt.Println(h)
}
func ExampleFuzzyReader() {
buffer := make([]byte, 4097)
rand.Read(buffer)
h, err := ssdeep.FuzzyReader(bytes.NewReader(buffer))
if err != nil {
log.Fatal(err)
}
fmt.Println(h)
}
func ExampleFuzzyFilename() {
h, err := ssdeep.FuzzyFilename("file.txt")
if err != nil {
log.Fatal(err)
}
fmt.Println(h)
}