From 488382619eeeaf4836dbece9a397eff4b9329c76 Mon Sep 17 00:00:00 2001 From: siddharth Date: Thu, 9 Sep 2021 18:14:14 -0400 Subject: lib: remove MTToken --- lib/rng.go | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'lib') 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. -} -- cgit v1.2.3