mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 14:20:55 +03:00
replace fnv with sha256
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -17,10 +17,11 @@ package dataprovider
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -108,12 +109,12 @@ func (n *NodeData) validate() error {
|
||||
}
|
||||
|
||||
func (n *NodeData) getNodeName() string {
|
||||
h := fnv.New64a()
|
||||
h := sha256.New()
|
||||
var b bytes.Buffer
|
||||
|
||||
b.WriteString(fmt.Sprintf("%s:%d", n.Host, n.Port))
|
||||
h.Write(b.Bytes())
|
||||
return strconv.FormatUint(h.Sum64(), 10)
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
// Node defines a cluster node
|
||||
|
||||
Reference in New Issue
Block a user