From dca2d7a30dd4ab68638d7047af6f06bb8bfc5406 Mon Sep 17 00:00:00 2001 From: Loic Gelle Date: Thu, 22 Jun 2017 16:09:04 -0700 Subject: [PATCH] fix obj path hashing --- parser.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parser.go b/parser.go index c5b7721..79abab1 100644 --- a/parser.go +++ b/parser.go @@ -8,6 +8,7 @@ import( "path/filepath" "strings" "crypto/sha256" + "encoding/base64" ) type ParserResult struct { @@ -242,8 +243,10 @@ func getArtifactNames(pr ParserResult, srcFileIndex int, hidden bool) (objBase s // Return a hash for the absolute object path func getHashedPath(path string) string { inputBytes := []byte(path) - hash := sha256.Sum256(inputBytes) - return string(hash[:]) + hasher := sha256.New() + hasher.Write(inputBytes) + hash := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) + return hash } func (pr *ParserResult) inputFileCallback(flag string, _ []string) {