Skip to content

Commit

Permalink
HashBytes API added
Browse files Browse the repository at this point in the history
  • Loading branch information
glaslos committed Jun 8, 2017
1 parent 1b5ceb5 commit f7560b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tlsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tlsh

import (
"bufio"
"bytes"
"fmt"
"io"
"math"
Expand Down Expand Up @@ -276,6 +277,12 @@ func HashReader(r fuzzyReader) (hash string, err error) {
return hash, nil
}

//HashBytes calculates the TLSH for the input byte slice
func HashBytes(blob []byte) (hash string, err error) {
r := bytes.NewReader(blob)
return HashReader(r)
}

//Hash calculates the TLSH for the input file
func Hash(filename string) (hash string, err error) {
f, err := os.Open(filename)
Expand Down

0 comments on commit f7560b4

Please sign in to comment.