You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
661 B
28 lines
661 B
package make_key
|
|
|
|
// Copyright (c) 2025 Robert Strutts <bobs@NewToFaith.com>
|
|
// License: MIT
|
|
// GIT: https://git.mysnippetsofcode.com/bobs/execguard
|
|
|
|
import (
|
|
"io"
|
|
"crypto/rand"
|
|
"encoding/base64"
|
|
"fmt"
|
|
)
|
|
|
|
func randReader() io.Reader {
|
|
return rand.Reader
|
|
}
|
|
|
|
func Make_a_key() bool{
|
|
// XXTEA key should be 16 bytes total...base64 will padd it...
|
|
key := make([]byte, 12)
|
|
if _, err := io.ReadFull(rand.Reader, key); err != nil {
|
|
fmt.Printf("Failed to generate key: %v", err)
|
|
return false
|
|
}
|
|
// Generated XXTEA key (base64):
|
|
fmt.Printf("%s", base64.StdEncoding.EncodeToString(key))
|
|
return true
|
|
}
|
|
|