GpuCbcMode

Mojo struct 🡭

GpuCbcMode

@memory_only
struct GpuCbcMode[Cipher: AsyncBlockCipherDecryptable & AsyncBlockCipherEncryptable & Copyable & Deinitable]

CBC block cipher mode of operation over an async (device-backed) cipher.

See NIST SP 800-38A, Section 6.2.

Both directions await one cipher call per block.

Aliases

  • BLOCK_SIZE = Cipher.BLOCK_SIZE

Parameters

  • Cipher (AsyncBlockCipherDecryptable & AsyncBlockCipherEncryptable & Copyable & Deinitable)

Implemented traits

AnyType, AsyncBlockCipherDecryptable, AsyncBlockCipherEncryptable, Copyable, Deinitable, Movable

Methods

__init__

fn def __init__(out self, var cipher: Cipher, var iv: Array[UInt8, Cipher.BLOCK_SIZE])

Args:

  • cipher (Cipher)
  • iv (Array[UInt8, Cipher.BLOCK_SIZE])
  • self (Self)

Returns:

Self

encrypt

fn def encrypt[o: MutOrigin](mut self, ctx: Context, data: Span[UInt8, o])

Parameters:

  • o (MutOrigin)

Args:

  • self (Self)
  • ctx (Context)
  • data (Span[UInt8, o])

Raises:

decrypt

fn def decrypt[o: MutOrigin](mut self, ctx: Context, data: Span[UInt8, o])

Parameters:

  • o (MutOrigin)

Args:

  • self (Self)
  • ctx (Context)
  • data (Span[UInt8, o])

Raises: