Skip to content

miniproto_native::crypto::mtproto_message_key

  • Rust visibility: restricted
  • Source: rust/miniproto/src/crypto.rs
  • Python exposure: miniproto._native.mtproto_message_key (confirmed from adjacent PyO3 attributes)
fn mtproto_message_key(py: _, auth_key: _, plaintext_with_padding: _, client_to_server: bool) -> _
  • py: The acquired GIL token used to detach a large hash operation.
  • auth_key: The 256-byte MTProto authorization key.
  • plaintext_with_padding: Inner plaintext including padding, with no alignment or padding validation here
  • client_to_server: Selects the directional MTProto key offset.
fn mtproto_message_key(py: Python<'_>, auth_key: std::borrow::Cow<'_, [u8]>, plaintext_with_padding: std::borrow::Cow<'_, [u8]>, client_to_server: bool) -> PyResult<Vec<u8>>

Defined in rust/miniproto/src/crypto.rs:148-163

Computes Python mtproto_message_key for padded plaintext and one MTProto direction.

Returns a 16-byte message key; rejects an invalid authorization key and releases the GIL for large inputs.

  • py: The acquired GIL token used to detach a large hash operation.
  • auth_key: The 256-byte MTProto authorization key.
  • plaintext_with_padding: Inner plaintext including padding, with no alignment or padding validation here
  • client_to_server: Selects the directional MTProto key offset.