Skip to content

Commit

Permalink
fixed hash length bug for general hashing.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyStiles committed Jun 29, 2020
1 parent ddcc87e commit 346e3eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
_ "crypto/sha512"
"encoding/hex"
"errors"
"io"

_ "golang.org/x/crypto/blake2b"
_ "golang.org/x/crypto/blake2s"
Expand Down Expand Up @@ -105,7 +106,8 @@ func GenericSequenceHash(annotatedSequence AnnotatedSequence, hash crypto.Hash)
annotatedSequence.Sequence.Sequence = RotateSequence(annotatedSequence.Sequence.Sequence)
}
h := hash.New()
return hex.EncodeToString(h.Sum([]byte(annotatedSequence.Sequence.Sequence))), nil
io.WriteString(h, annotatedSequence.Sequence.Sequence)
return hex.EncodeToString(h.Sum(nil)), nil
}

// method wrapper for hashing annotatedSequence structs.
Expand Down

0 comments on commit 346e3eb

Please sign in to comment.