cmd/sgblog/http.go | 22 +++++----------------- go.mod | 4 +++- go.sum | 4 ++++ diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index bcc7d501162dced51f1effb14561dcc2f885c4e93294bad5510090be410182bd..9b1640ebaa90c9c7f4c64728c3ec2d51974c6df59d5c6b3e6099090684f95a3e 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -44,7 +44,7 @@ "github.com/go-git/go-git/v5/plumbing/object" "github.com/vorlif/spreak" "go.stargrave.org/sgblog" "go.stargrave.org/sgblog/cmd/sgblog/atom" - "golang.org/x/crypto/blake2b" + "lukechampine.com/blake3" ) const ( @@ -186,10 +186,7 @@ if err != nil { makeErr(err, http.StatusBadRequest) } - etagHash, err := blake2b.New256(nil) - if err != nil { - panic(err) - } + etagHash := blake3.New(32, nil) for _, s := range []string{ "SGBLOG", sgblog.Version, @@ -435,10 +432,7 @@ title = cfg.Title } else { title = fmt.Sprintf("%s (topic: %s)", cfg.Title, topic) } - idHasher, err := blake2b.New256(nil) - if err != nil { - panic(err) - } + idHasher := blake3.New(32, nil) idHasher.Write([]byte("ATOM POSTS")) idHasher.Write([]byte(cfg.AtomId)) idHasher.Write([]byte(topic)) @@ -522,10 +516,7 @@ } etagHash.Write([]byte("ATOM COMMENTS")) etagHash.Write(commit.Hash[:]) checkETag(etagHash) - idHasher, err := blake2b.New256(nil) - if err != nil { - panic(err) - } + idHasher := blake3.New(32, nil) idHasher.Write([]byte("ATOM COMMENTS")) idHasher.Write([]byte(cfg.AtomId)) feed := atom.Feed{ @@ -653,10 +644,7 @@ date: strings.Replace(date, " ", "T", 1), body: lines[3:], }) } - idHasher, err := blake2b.New256(nil) - if err != nil { - panic(err) - } + idHasher := blake3.New(32, nil) idHasher.Write([]byte("ATOM COMMENTS")) idHasher.Write(commit.Hash[:]) feed := atom.Feed{ diff --git a/go.mod b/go.mod index a637de4afe7787d8d6b9dc9d0b3552defaeb3690774f56d15e8d3ed544aee79d..6027c1ae275fec87f3ce0fa63b05efce65c7e24ad7cb50865182989704844659 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ github.com/go-git/go-git/v5 v5.4.2 github.com/hjson/hjson-go v3.3.0+incompatible github.com/vorlif/spreak v0.4.0 go.cypherpunks.ru/recfile v0.7.0 - golang.org/x/crypto v0.7.0 golang.org/x/text v0.8.0 + lukechampine.com/blake3 v1.2.1 ) require ( @@ -22,9 +22,11 @@ github.com/go-git/go-billy/v5 v5.3.1 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/xanzy/ssh-agent v0.3.2 // indirect + golang.org/x/crypto v0.7.0 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index 74ec597f53a76662ba09cbe9e6d9d3dbe1c0a467464a0dfe4a4d01ab91d5775c..1c6aa0bc9abcc07ff3414da66a401f0903386d05030a85e35bcd321611457a9f 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,8 @@ github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= @@ -140,3 +142,5 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=