Properly seed randomness

I am not really sure how that went unnoticed.
This commit is contained in:
Spotlight 2022-01-09 21:05:58 -06:00
parent f27c980c44
commit cad9816315
No known key found for this signature in database
GPG Key ID: 874AA355B3209BDC
2 changed files with 11 additions and 7 deletions

7
ecs.go
View File

@ -154,13 +154,8 @@ func purchaseTitle(e *Envelope) {
})
e.AddKVNode("SyncTime", e.Timestamp())
//// Two cert types must be present.
//type Certs struct {
// XMLName xml.Name `xml:"Certs"`
// Value string `xml:",chardata"`
//}
e.AddKVNode("ETickets", ticketString)
// Two cert types must be present.
e.AddKVNode("Certs", b64(wadlib.CertChainTemplate))
e.AddKVNode("Certs", b64(wadlib.CertChainTemplate))
e.AddKVNode("TitleId", titleId)

11
main.go
View File

@ -19,11 +19,15 @@ package main
import (
"context"
crypto "crypto/rand"
"encoding/xml"
"fmt"
"github.com/jackc/pgx/v4/pgxpool"
"io/ioutil"
"log"
"math"
"math/big"
"math/rand"
"net/http"
)
@ -47,10 +51,15 @@ func checkError(err error) {
}
func main() {
// Seed our random number generator before anything else.
seed, err := crypto.Int(crypto.Reader, big.NewInt(math.MaxInt64))
checkError(err)
rand.Seed(seed.Int64())
// Initial Start.
fmt.Println("WiiSOAP 0.2.6 Kawauso\n[i] Reading the Config...")
// Check the Config.
// Check the config.
ioconfig, err := ioutil.ReadFile("./config.xml")
checkError(err)
readConfig := Config{}