ceremonyclient/bedlam/pkg/crypto/aes/cipher.qcl
Cassandra Heart dbd95bd9e9
v2.1.0 (#439)
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete

* 2.1.0 main node rollup
2025-09-30 02:48:15 -05:00

34 lines
821 B
Go

// -*- go -*-
//
// Copyright (c) 2020-2021 Markku Rossi
//
// All rights reserved.
//
// Package aes implements the Advanced Encryption Standard (AES)
// block cipher operations.
package aes
// BlockSize defines the AES cipher block size in bytes.
const BlockSize = 16
// EncryptBlock encrypts one data block with the key. The key must be
// 16, 24, or 32 bytes long.
func EncryptBlock(key []byte, data [BlockSize]byte) [BlockSize]byte {
enc := ExpandEncryptionKey(key)
var dst [BlockSize]byte
return EncryptBlockExpanded(enc, dst, data)
}
// DecryptBlock decrypts one data block with the key. The key must be
// 16, 24, or 32 bytes long.
func DecryptBlock(key []byte, data [BlockSize]byte) [BlockSize]byte {
enc, dec := ExpandKey(key)
var dst [BlockSize]byte
return DecryptBlockExpanded(dec, dst, data)
}