-/*
-paster -- paste service
-Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+// paster -- paste service
+// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
"bufio"
"bytes"
"crypto/rand"
- "crypto/sha512"
_ "embed"
"encoding/base32"
"encoding/hex"
"os"
"go.cypherpunks.ru/netstring/v2"
+ "lukechampine.com/blake3"
)
const MaxExtLen = 9
if err != nil {
fatal(err.Error())
}
- h := sha512.New()
+ h := blake3.New(32, nil)
bfd := bufio.NewWriter(fd)
mw := io.MultiWriter(bfd, h)
buf := make([]byte, 1)
for _, u := range flag.Args() {
fmt.Println(u + fn[1:])
}
- fmt.Println("SHA512/2:", hex.EncodeToString(h.Sum(nil)[:sha512.Size/2]))
+ fmt.Println("BLAKE3-256:", hex.EncodeToString(h.Sum(nil)))
if ext == ".cast" && *asciicastPath != "" {
if err = asciicastHTML(*asciicastPath, fn[1:]); err != nil {
goto Failed