Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix header info message #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/commands/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func Split(path string, destination string, total int, threshold int) error {
}
defer horcruxFile.Close()

if _, err := horcruxFile.WriteString(header(index, total, headerBytes)); err != nil {
if _, err := horcruxFile.WriteString(header(index, total, threshold, headerBytes)); err != nil {
return err
}

Expand Down Expand Up @@ -155,7 +155,7 @@ func obtainTotalAndThreshold() (int, int, error) {
return total, threshold, nil
}

func header(index int, total int, headerBytes []byte) string {
func header(index int, total int, threshold int, headerBytes []byte) string {
return fmt.Sprintf(`# THIS FILE IS A HORCRUX.
# IT IS ONE OF %d HORCRUXES THAT EACH CONTAIN PART OF AN ORIGINAL FILE.
# THIS IS HORCRUX NUMBER %d.
Expand All @@ -165,7 +165,7 @@ func header(index int, total int, headerBytes []byte) string {
-- HEADER --
%s
-- BODY --
`, total, index, total-1, headerBytes)
`, total, index, threshold, headerBytes)
}

func generateKey() ([]byte, error) {
Expand Down