Dưới đây là cấu trúc khởi tạo một luồng mã hóa bảo mật cơ bản:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package main

import (
	"crypto/aes"
	"crypto/cipher"
	"fmt"
)

func main() {
	key := []byte("AES256Key-32Characters1234567890")
	block, err := aes.NewCipher(key)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("Block size: %d bytes\n", block.BlockSize())
}