Switch to crc32 as TOML cannot encode MaxUint64

This commit is contained in:
2023-01-12 18:29:31 -08:00
parent 928b5e8bab
commit 9442934541
2 changed files with 7 additions and 23 deletions

View File

@@ -1,8 +1,7 @@
package main
import (
"hash/crc64"
"io"
"hash/crc32"
"os"
"github.com/pelletier/go-toml/v2"
@@ -28,17 +27,8 @@ func genIDCmd(c *cli.Context) error {
}
fl.Close()
hash := crc64.New(crc64.MakeTable(crc64.ISO))
for i, item := range tr.Items {
hash.Reset()
_, err := io.WriteString(hash, item.Value)
if err != nil {
return err
}
tr.Items[i].ID = hash.Sum64()
tr.Items[i].ID = crc32.ChecksumIEEE([]byte(item.Value))
}
fl, err = os.Create(c.Args().First())