Class Camellia256
- Namespace
- CryptoHives.Foundation.Security.Cryptography.Cipher
- Assembly
- CryptoHives.Foundation.Security.Cryptography.dll
Camellia-256 symmetric cipher implementation.
public sealed class Camellia256 : SymmetricCipher, IDisposable
- Inheritance
-
Camellia256
- Implements
- Inherited Members
Remarks
Camellia-256 uses a 256-bit (32-byte) key with 24 rounds of encryption. It is specified in RFC 3713 and ISO/IEC 18033-3.
Security level: 256 bits (quantum: 128 bits with Grover's algorithm)
Recommendations:
- Use Camellia-256 for long-term security requirements.
- Recommended for post-quantum resistance (Grover's algorithm halves security).
Example usage:
using var camellia = Camellia256.Create();
camellia.Mode = CipherMode.CBC;
camellia.Padding = PaddingMode.PKCS7;
camellia.GenerateKey();
camellia.GenerateIV();
byte[] ciphertext = camellia.Encrypt(plaintext);
byte[] decrypted = camellia.Decrypt(ciphertext);
Constructors
Camellia256()
Initializes a new instance of the Camellia256 class.
public Camellia256()
Fields
KeySizeBits
Key size in bits for Camellia-256.
public const int KeySizeBits = 256
Field Value
KeySizeBytes
Key size in bytes for Camellia-256.
public const int KeySizeBytes = 32
Field Value
Properties
AlgorithmName
Gets the name of the cipher algorithm.
public override string AlgorithmName { get; }
Property Value
Examples
"AES-256", "ChaCha20", "AES-256-GCM"
IVSize
Gets the required IV/nonce size in bytes for the current mode.
public override int IVSize { get; }
Property Value
Methods
Create()
Creates a new instance of the Camellia256 cipher.
public static Camellia256 Create()
Returns
- Camellia256
A new Camellia-256 cipher instance.
CreateCipherDecryptor(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Creates a decryptor transform using the specified key and IV.
protected override ICipherTransform CreateCipherDecryptor(ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
Parameters
keyReadOnlySpan<byte>The secret key.
ivReadOnlySpan<byte>The initialization vector or nonce.
Returns
- ICipherTransform
A new cipher decryptor transform.
CreateCipherEncryptor(ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Creates an encryptor transform using the specified key and IV.
protected override ICipherTransform CreateCipherEncryptor(ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
Parameters
keyReadOnlySpan<byte>The secret key.
ivReadOnlySpan<byte>The initialization vector or nonce.
Returns
- ICipherTransform
A new cipher encryptor transform.