summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-09-09 18:14:14 -0400
committersiddharth <s@ricketyspace.net>2021-09-09 18:14:14 -0400
commit488382619eeeaf4836dbece9a397eff4b9329c76 (patch)
treef2730ae3a02decd6a7f358e6ae72a9f9f6f219bc /lib
parent30cb7a39dd5338639a30cd937ac1a1d0621a1c92 (diff)
lib: remove MTToken
Diffstat (limited to 'lib')
-rw-r--r--lib/rng.go23
1 files changed, 0 insertions, 23 deletions
diff --git a/lib/rng.go b/lib/rng.go
index f16aeae..30cca3d 100644
--- a/lib/rng.go
+++ b/lib/rng.go
@@ -143,26 +143,3 @@ func MTXORStream(stream, seed []byte) []byte {
return s
}
-// Returns a "random" token of length `length` using MT19937 seeded
-// with `seed`. The returned token is a hex string.
-func MTToken(seed uint32, length int) string {
- if length < 16 {
- length = 16 // Default length.
- }
-
- // Init MT19937.
- mtR := new(MTRand)
- mtR.Seed(seed)
-
- n := uint32(0)
- t := make([]byte, 0) // Token in bytes.
- for i := 0; i < length; i++ {
- if n == uint32(0) {
- n = mtR.Extract()
- }
- t = append(t, byte(n&0xFF)) // Extract last 8 bits.
- n = n >> 8 // Get rid of the last 8 bits.
- }
-
- return BytesToHexStr(t) // Return token as a hex string.
-}