Adjust some Go related things

This commit is contained in:
2025-10-29 16:22:55 -04:00
parent 9563ad252d
commit b8a4839196
8 changed files with 43 additions and 43 deletions

View File

@@ -4,29 +4,28 @@ package otpgenerate
import (
"crypto/rand"
paddefinitions "dotp/pad_definitions"
"math/big"
"one-time-pad-utils/pad_definitions"
)
func GenerateOTP(chunks int) string {
count := 1
otpstring := ""
for count < (chunks*5)+1{
for count < (chunks*5)+1 {
n, err := rand.Int(rand.Reader, big.NewInt(36)) // generate new cryptographically secure random number
if err != nil {
panic(err)
}
otpstring += paddefinitions.NumToCharMap[int(n.Int64())] // print that number using the character map
if count % 5 == 0 { // add a space every 5 characters, newline after 10 chunks
if count % 50 == 0{
if count%5 == 0 { // add a space every 5 characters, newline after 10 chunks
if count%50 == 0 {
otpstring += "\n"
} else {
otpstring += " "
}
}
count+=1
count += 1
}
return otpstring