AES class

AES (Advanced Encryption Standard) is a symmetric encryption algorithm used for securing data. It operates on fixed-size blocks of data (128 bits) using keys of 128, 192, or 256 bits.

The process involves multiple rounds of substitution, permutation, mixing, and key addition to transform plaintext into ciphertext. Decryption reverses this process, using the same key to recover the original plaintext.

AES is known for its high speed and strong security, making it suitable for various applications,including data protection in software and hardware.

Constructors

AES.new(List<int> key, [Padding padding = Padding.pkcs7])
Creates an AES algorithm instance with the key, where the length of the key must be either 16, 24, or 32-bytes. An additional padding parameter can be configured for modes that requires a padding scheme.
const
AES.ansi(List<int> key)
Creates AES instances with Padding.ansi
factory
AES.byte(List<int> key)
Creates AES instances with Padding.byte
factory
AES.noPadding(List<int> key)
Creates AES instances with Padding.none
factory
AES.pkcs7(List<int> key)
Creates AES instances with Padding.pkcs7
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
key List<int>
The key for encryption and decryption
final
padding Padding
The padding scheme for the messages
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cbc(List<int> iv) AESInCBCMode
The Cipher Block Chaining (CBC) mode chains together blocks of plaintext by XORing each block with the previous ciphertext block before encryption. An initialization vector (IV) is used for the first block to ensure unique encryption. CBC mode provides better security than ECB but requires sequential processing.
cfb(List<int> iv, [int sbyte = 16]) AESInCFBMode
The CFB (Cipher Feedback) mode turns a block cipher into a self-synchronizing stream cipher. It uses the previous ciphertext block as input to the block cipher to produce a keystream, which is then XORed with the plaintext to produce ciphertext. CFB does not require a padding to the plaintext and can be used for error recovery.
cfb128(List<int> iv) AESInCFBMode
Variant of cfb with s = 128
cfb64(List<int> iv) AESInCFBMode
Variant of cfb with s = 64
cfb8(List<int> iv) AESInCFBMode
Variant of cfb with s = 8
ctr(List<int> iv) AESInCTRMode
The Counter (CTR) mode converts a block cipher into a stream cipher by encrypting a counter value with a nonce. The resulting keystream is then XORed with the plaintext to produce ciphertext. CTR mode allows parallel encryption and decryption, making it efficient for high-performance applications.
ecb() AESInECBMode
The Electronic Codeblock (ECB) mode encrypts each block of plaintext independently using the same key.
gcm(List<int> iv, {Iterable<int>? aad, int tagSize = 16}) AESInGCMMode
The Galois Counter Mode (GCM) is an advanced mode of operation for block ciphers that combines the counter mode of encryption with Galois field multiplication for authentication. GCM provides both data confidentiality and authenticity, making it a widely used and highly secure mode.
ige(List<int> iv) AESInIGEMode
The Infinite Garble Extension (IGE) mode is specifically designed to provide error propagation, which is useful in certain cryptographic applications.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ofb(List<int> iv, [int sbyte = 16]) AESInOFBMode
The Output Feedback (OFB) mode operates similarly to CFB but generates the keystream independently of both plaintext and ciphertext. This makes OFB immune to transmission errors but requires careful management of the IV to avoid security issues.
ofb128(List<int> iv) AESInOFBMode
Variant of ofb with s = 128
ofb64(List<int> iv) AESInOFBMode
Variant of ofb with s = 64
ofb8(List<int> iv) AESInOFBMode
Variant of ofb with s = 8
pcbc(List<int> iv) AESInPCBCMode
The Propagating Cipher Block Chaining (PCBC) mode is a variant of CBC that propagates changes to both the plaintext and the ciphertext, making it more resilient to certain attacks. It is not as commonly used as other modes but can provide additional security in some scenarios.
toString() String
A string representation of this object.
inherited
xts(List<int> tweak) AESInXTSMode
The XTS or XEX (XOR-Encrypt-XOR) Tweakable Block Cipher with Ciphertext Stealing mode is a disk encryption mode of operation for cryptographic block ciphers. It is designed specifically for encrypting data stored on block-oriented storage devices.

Operators

operator ==(Object other) bool
The equality operator.
inherited