For example,
package main
import (
"fmt"
"math/rand"
"time"
)
func padWithRandomBytes(b []byte) []byte {
s := 5 + rand.Intn(5+1)
e := 5 + rand.Intn(5+1)
slicer := make([]byte, s+len(b)+e)
copy(slice[sr[s:], b)
return slicer
}
func main() {
rand.Seed(time.Now().UnixNano())
b := []byte{1, 2, 3}
fmt.Println(len(b), b)
sr := padWithRandomBytes(b)
fmt.Println(len(sr), sr)
}
Output (random):
3 [1 2 3]
20 [0 0 0 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 0]
3 [1 2 3]
15 [0 0 0 0 0 0 1 2 3 0 0 0 0 0 0]