Skip to content

miniproto_native::crypto::mtproto_message_key

  • Crate: miniproto_native
  • 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: Block-aligned inner plaintext that contributes to the message key.
  • client_to_server: Selects the directional MTProto key offset.
fn mtproto_message_key(py: Python<'_>, auth_key: Vec<u8>, plaintext_with_padding: Vec<u8>, client_to_server: bool) -> PyResult<Vec<u8>>

Defined in rust/miniproto/src/crypto.rs:142-157

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: Block-aligned inner plaintext that contributes to the message key.
  • client_to_server: Selects the directional MTProto key offset.