diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-08-28 23:48:48 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-08-28 23:48:48 -0700 |
| commit | ca658a97c5248ba099356b006f0b341af53b0816 (patch) | |
| tree | 8b59defed9a417c4fa2e9346a23cd8a64e851852 /weed/util/bytes.go | |
| parent | 63ad1abccec691d2204b8dc63109ffeead0b0eed (diff) | |
| download | seaweedfs-ca658a97c5248ba099356b006f0b341af53b0816.tar.xz seaweedfs-ca658a97c5248ba099356b006f0b341af53b0816.zip | |
add signatures to messages to avoid double processing
Diffstat (limited to 'weed/util/bytes.go')
| -rw-r--r-- | weed/util/bytes.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/util/bytes.go b/weed/util/bytes.go index 890d50586..82e4ddeef 100644 --- a/weed/util/bytes.go +++ b/weed/util/bytes.go @@ -2,6 +2,7 @@ package util import ( "crypto/md5" + "crypto/rand" "encoding/base64" "fmt" "io" @@ -135,3 +136,9 @@ func Base64Md5ToBytes(contentMd5 string) []byte { } return data } + +func RandomInt32() int32 { + buf := make([]byte, 4) + rand.Read(buf) + return int32(BytesToUint32(buf)) +} |
