Skip to content

Commit

Permalink
Use modules, update readme, add test driver
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzak committed Feb 27, 2021
1 parent 08bbb15 commit ce0fa69
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
25 changes: 25 additions & 0 deletions cmd/test/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"github.com/malwaredb/golzjd"
"os"
"fmt"
)

func main() {
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "Usages:\n")
fmt.Fprintf(os.Stderr, "\t%s <File> to see LZJD hash of a file\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\t%s <File> <File> to use LZJD to calculate similarity\n", os.Args[0])
os.Exit(1)
}

firstFile := golzjd.GenerateHashFromFile(os.Args[1])
if len(os.Args) > 2 {
secondFile := golzjd.GenerateHashFromFile(os.Args[2])
similarity := golzjd.CompareHashes(firstFile, secondFile)
fmt.Printf("Similarity: %d\n", similarity)
} else {
fmt.Printf("Hash: %s\n", firstFile)
}
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/malwaredb/golzjd

go 1.16
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# golzjd

This project is a work in progress to convert Edward Raff's original [LZJD](https://github.com/EdwardRaff/LZJD) to Go. To use LZJD with your project, run `go get github.com/rjzak/golzjd`, and import the project into your Go file. For more information about LZJD itself, read the [original paper](https://arxiv.org/abs/1708.03346).
This project is a work in progress to convert Edward Raff's original [LZJD](https://github.com/EdwardRaff/LZJD) to Go. To use LZJD with your project, run `go get github.com/malwaredb/golzjd`, and import the project into your Go file. For more information about LZJD itself, read the [original paper](https://arxiv.org/abs/1708.03346).

## Example use

Expand Down

0 comments on commit ce0fa69

Please sign in to comment.