AesGpu

Mojo struct 🡭

AesGpu

@memory_only
struct AesGpu[KEY_SIZE: Int]

Aliases

  • BLOCK_SIZE = BLOCK_SIZE
  • NK = (KEY_SIZE // Int(4))
  • NR = ((KEY_SIZE // Int(4)) + Int(6))
  • WORDS_SIZE = (Int(4) * Int((add (KEY_SIZE // Int(4)), 7)))

Parameters

  • KEY_SIZE (Int)

Fields

  • w (DeviceBuffer[.uint32])
  • sbox (DeviceBuffer[.uint32])
  • sbox_inv (DeviceBuffer[.uint8])

Implemented traits

AnyType, AsyncBlockCipherDecryptable, AsyncBlockCipherEncryptable, Copyable, Deinitable, Movable

Methods

__init__

fn def __init__(out self, *, var w: DeviceBuffer[.uint32], var sbox: DeviceBuffer[.uint32], var sbox_inv: DeviceBuffer[.uint8])

Args:

  • w (DeviceBuffer[.uint32])
  • sbox (DeviceBuffer[.uint32])
  • sbox_inv (DeviceBuffer[.uint8])
  • self (Self)

Returns:

Self

create

@staticmethod
fn def create(ctx: Context, key: Array[UInt8, KEY_SIZE]) -> Self

Upload the key schedule and S-boxes, and return the cipher once they have landed on the device.

Args:

  • ctx (Context)
  • key (Array[UInt8, KEY_SIZE])

Returns:

Self

Raises:

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: