]> Sergey Matveev's repositories - paster.git/blobdiff - main.go
BLAKE3
[paster.git] / main.go
diff --git a/main.go b/main.go
index 25e93d4f45ad03d34809e6b1f153b6673b3e6124..c1bc2712484828c6b1ba80781c0ae2695df1a720 100644 (file)
--- a/main.go
+++ b/main.go
@@ -21,7 +21,6 @@ import (
        "bufio"
        "bytes"
        "crypto/rand"
-       "crypto/sha512"
        _ "embed"
        "encoding/base32"
        "encoding/hex"
@@ -32,6 +31,7 @@ import (
        "os"
 
        "go.cypherpunks.ru/netstring/v2"
+       "lukechampine.com/blake3"
 )
 
 const MaxExtLen = 9
@@ -122,7 +122,7 @@ func main() {
        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)
@@ -159,7 +159,7 @@ func main() {
        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