aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/storage.go8
-rw-r--r--core/verification.go6
2 files changed, 7 insertions, 7 deletions
diff --git a/core/storage.go b/core/storage.go
index d3dc3da..8208006 100644
--- a/core/storage.go
+++ b/core/storage.go
@@ -103,13 +103,13 @@ func ReadHeader(partition string) (Header, error) {
return Header{}, err
}
- header.Signature = fmt.Sprintf("untrusted comment: fsverify\r\n%s\r\ntrusted comment: fsverify\r\n%s\r\n", UntrustedHash, TrustedHash)
+ header.Signature = fmt.Sprintf("untrusted comment: fsverify\n%s\ntrusted comment: fsverify\n%s\n", string(UntrustedHash), string(TrustedHash))
header.FilesystemSize = int(binary.BigEndian.Uint16(FilesystemSize))
header.TableSize = int(binary.BigEndian.Uint32(TableSize))
header.FilesystemUnit = parseUnitSpec(FilesystemUnit)
header.TableUnit = parseUnitSpec(TableUnit)
if header.FilesystemUnit == -1 || header.TableUnit == -1 {
- return Header{}, fmt.Errorf("Error: unit size for Filesystem or Table invalid: fs: %x, table: %x", FilesystemUnit, TableUnit)
+ return Header{}, fmt.Errorf("unit size for Filesystem or Table invalid: fs: %x, table: %x", FilesystemUnit, TableUnit)
}
return header, nil
}
@@ -146,7 +146,7 @@ func ReadDB(partition string) (string, error) {
return "", err
}
if n != header.TableSize*header.TableUnit {
- return "", fmt.Errorf("Error: Database is not expected size. Got: %d, expected %d", n, header.TableSize*header.TableUnit)
+ return "", fmt.Errorf("Database is not expected size. Expected %d, got %d", header.TableSize*header.TableUnit, n)
}
fmt.Printf("db: %d\n", n)
@@ -204,7 +204,7 @@ func CopyByteArea(start int, end int, reader *bytes.Reader) ([]byte, error) {
if err != nil {
return nil, err
} else if n != end-start {
- return nil, fmt.Errorf("Unable to read requested size. Got %d, expected %d", n, end-start)
+ return nil, fmt.Errorf("Unable to read requested size. Expected %d, got %d", end-start, n)
}
return bytes, nil
}
diff --git a/core/verification.go b/core/verification.go
index 1193664..f1e1f0b 100644
--- a/core/verification.go
+++ b/core/verification.go
@@ -27,7 +27,7 @@ func fileReadKey() (string, error) {
reader := bufio.NewReader(file)
n, err := reader.Read(key)
if n != 56 {
- return "", fmt.Errorf("Error: Key does not match expected key size. expected 56, got %d", n)
+ return "", fmt.Errorf("Key does not match expected key size. Expected 56, got %d", n)
}
if err != nil {
return "", err
@@ -74,7 +74,7 @@ func serialReadKey() (string, error) {
key = strings.ReplaceAll(key, "\\t", "")
key = strings.ReplaceAll(key, "\"", "")
if len(key) != 56 {
- return "", fmt.Errorf("Error: Key does not match expected key size. expected 56, got %d", len(key))
+ return "", fmt.Errorf("Key does not match expected key size. Expected 56, got %d", len(key))
}
return key, nil
}
@@ -132,7 +132,7 @@ func VerifyBlock(block []byte, node Node) error {
if strings.Compare(calculatedBlockHash, strings.TrimSpace(wantedBlockHash)) == 0 {
return nil
}
- return fmt.Errorf("Error: Node %s ranging from %d to %d does not match block. Expected %s, got %s.", node.PrevNodeSum, node.BlockStart, node.BlockEnd, wantedBlockHash, calculatedBlockHash)
+ return fmt.Errorf("Node %s ranging from %d to %d does not match block. Expected %s, got %s.", node.PrevNodeSum, node.BlockStart, node.BlockEnd, wantedBlockHash, calculatedBlockHash)
}
func VerifyNode(node Node, nextNode Node) error {