magma - v0.1.3
    Preparing search index...

    Class Magma

    Magma core class

    Index

    Constructors

    • Magma core class

      Parameters

      • key: Uint8Array

        Encryption key

      • sbox: Sbox = sboxes.ID_TC26_GOST_28147_PARAM_Z

        S-Box

      Returns Magma

    Methods

    • Decrypts single block of data using Magma (Feistel network) encryption algorithm.

      Parameters

      • block: Uint8Array

        Block to be decrypted

      Returns Uint8Array

      Decrypted block

      Block size is invalid or data is too short

    • Encrypts single block of data using Magma (Feistel network) encryption algorithm.

      Parameters

      • block: Uint8Array

        Block to be encrypted

      Returns Uint8Array

      Encrypted block

      Block size is invalid or data is too short

    • Returns round keys

      Returns number[]

    • Applies the G-transformation (Feistel round function) to input value. Performs addition with round key, applies T-transformation, and performs cyclic left shift.

      Parameters

      • a: number

        Input 32-bit value to be transformed

      • k: number

        Round key used in the transformation

      Returns number

      Transformed 32-bit value after G-transformation

    • Applies substitution transformation (T-transformation) using S-box. Breaks input value into 4-bit parts, substitutes each part using corresponding S-box row, and reconstructs transformed value.

      Parameters

      • value: number

        Value to be transformed

      Returns number

      Transformed 32-bit value after substitution

    • Convert bytes to uint32 number

      Parameters

      • bytes: Uint8Array

      Returns number

    • Convert uint32 number to bytes

      Parameters

      • value: number
      • buffer: Uint8Array
      • offset: number

      Returns void