]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/tmp.go
Sequential MTH optimization
[nncp.git] / src / tmp.go
index da96a25bfd0785f9bdc7b8aa48e523b01c47360f..a1ef2e86f53f2981a8979920050950c35760946e 100644 (file)
@@ -26,8 +26,6 @@ import (
        "path/filepath"
        "strconv"
        "time"
-
-       "golang.org/x/crypto/blake2b"
 )
 
 func TempFile(dir, prefix string) (*os.File, error) {
@@ -39,8 +37,7 @@ func TempFile(dir, prefix string) (*os.File, error) {
 
 func (ctx *Ctx) NewTmpFile() (*os.File, error) {
        jobsPath := filepath.Join(ctx.Spool, "tmp")
-       var err error
-       if err = os.MkdirAll(jobsPath, os.FileMode(0777)); err != nil {
+       if err := os.MkdirAll(jobsPath, os.FileMode(0777)); err != nil {
                return nil, err
        }
        fd, err := TempFile(jobsPath, "")
@@ -64,10 +61,7 @@ func (ctx *Ctx) NewTmpFileWHash() (*TmpFileWHash, error) {
        if err != nil {
                return nil, err
        }
-       hsh, err := blake2b.New256(nil)
-       if err != nil {
-               return nil, err
-       }
+       hsh := MTHNew(0, 0)
        return &TmpFileWHash{
                W:   bufio.NewWriter(io.MultiWriter(hsh, tmp)),
                Fd:  tmp,