diff --git a/line_obfuscator.go b/line_obfuscator.go index 06beeb3..c1f472c 100644 --- a/line_obfuscator.go +++ b/line_obfuscator.go @@ -80,15 +80,12 @@ func findBuildTags(commentGroups []*ast.CommentGroup) (buildTags []string) { return buildTags } -func transformLineInfo(fileName string, file *ast.File, fset *token.FileSet) ([]string, *ast.File) { +func transformLineInfo(file *ast.File, fset *token.FileSet) ([]string, *ast.File) { // Save build tags and add file name leak protection extraComments := append(findBuildTags(file.Comments), "", "//line :1") file.Comments = nil - fileSeed := hashWithAsInt64(buildInfo.buildID, fileName) - fileRand := mathrand.New(mathrand.NewSource(fileSeed)) - - newLines := fileRand.Perm(fset.File(file.Package).LineCount()) + newLines := mathrand.Perm(fset.File(file.Package).LineCount()) funcCounter := 0 pre := func(cursor *astutil.Cursor) bool { @@ -105,7 +102,7 @@ func transformLineInfo(fileName string, file *ast.File, fset *token.FileSet) ([] return true } - comment := &ast.Comment{Text: fmt.Sprintf("//line %c.go:%d", nameCharset[fileRand.Intn(len(nameCharset))], 1+newLines[funcCounter])} + comment := &ast.Comment{Text: fmt.Sprintf("//line %c.go:%d", nameCharset[mathrand.Intn(len(nameCharset))], 1+newLines[funcCounter])} funcDecl.Doc = prependComment(funcDecl.Doc, comment) funcCounter++ return true diff --git a/main.go b/main.go index 3536ac1..5a15d40 100644 --- a/main.go +++ b/main.go @@ -526,7 +526,7 @@ func transformCompile(args []string) ([]string, error) { // messy. name = "_cgo_" + name default: - extraComments, file = transformLineInfo(origName, file, fset) + extraComments, file = transformLineInfo(file, fset) file = transformGo(file, info, blacklist) // Uncomment for some quick debugging. Do not delete.