Skip to content

Commit

Permalink
As of Go 1.20 there is no reason to call Seed with a random value htt…
Browse files Browse the repository at this point in the history
  • Loading branch information
klml committed Apr 5, 2024
1 parent 36862d3 commit 76a8e3b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ If the hyperlink gets stolen, this message is disclosed.

## Build

golang>1.20 is required

```
CGO_ENABLED=0 go build ./msgsplit.go
```

## Run

```
./msgsplit.go
```
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>message split</title>
<link rel="stylesheet" href="./static/msgsplit.css" type="text/css" />
<script type="text/javascript" src="./static/msgsplit.js"></script>
<meta name="version" content="0.1.3"/>
<meta name="version" content="0.1.4"/>
</head>
<body>
<div class="panel">
Expand Down
13 changes: 0 additions & 13 deletions msgsplit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,9 @@ import (
"fmt"
"os"
"net/http"
crypto_rand "crypto/rand"
"encoding/binary"
math_rand "math/rand"
)

// seed rand
// wanted to use https://github.com/google/uuid , but modules are a bigger threat
// from https://stackoverflow.com/a/54491783/2248997
func init() {
var b [8]byte
_, err := crypto_rand.Read(b[:])
if err != nil {
panic("cannot seed math/rand package with cryptographically secure random number generator")
}
math_rand.Seed(int64(binary.LittleEndian.Uint64(b[:])))
}

func main() {
// this is a wedged CRUD
Expand Down

0 comments on commit 76a8e3b

Please sign in to comment.