-
Notifications
You must be signed in to change notification settings - Fork 158
style: enable gosec linter #1202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 34 commits
d24bd6a
b465187
969b51e
01395ef
3b51256
fb0a1c6
6021c88
e2dd1c0
eab8c81
e9e136d
66e1c6f
7cbf4c8
f92fa5a
37f65a0
57ec43b
5fd167c
b050e4f
d960769
c121ab6
eaf433d
341e908
7172e4f
40ebd2b
80c06b8
603dd3b
57989a3
b244df3
62ec0ca
8e657bf
e02b224
8d0388a
62612f3
1f1bb2a
6786d70
791ba8d
7da3ca1
28e116d
ba427bb
bc84850
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ linters: | |
- goconst | ||
- gocritic | ||
- goprintffuncname | ||
# - gosec | ||
- gosec | ||
- govet | ||
- importas | ||
- ineffassign | ||
|
JonathanOppenheimer marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package rand | ||
|
||
import ( | ||
"crypto/rand" | ||
"encoding/binary" | ||
"math" | ||
) | ||
|
||
func SecureFloat64() float64 { | ||
|
||
var b [8]byte | ||
if _, err := rand.Read(b[:]); err != nil { | ||
panic("crypto/rand failed: " + err.Error()) | ||
} | ||
bits := binary.BigEndian.Uint64(b[:]) | ||
bits = (bits >> 12) | (1023 << 52) // 52-bit mantissa, exponent=1023 -> [1,2) | ||
return math.Float64frombits(bits) - 1.0 | ||
} |
Uh oh!
There was an error while loading. Please reload this page.