magma - v0.1.8
    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 cipher.

      Parameters

      • block: Uint8Array

        Block to be decrypted

      Returns Uint8Array

    • Decrypt single block of data using old Magma (GOST 28147-89) algorithm

      Parameters

      • block: Uint8Array

      Returns Uint8Array

    • Encrypts single block of data using Magma cipher.

      Parameters

      • block: Uint8Array

        Block to be encrypted

      Returns Uint8Array

    • Encrypt single block of data using old Magma (GOST 28147-89) algorithm

      Parameters

      • block: Uint8Array

      Returns Uint8Array

    • Returns round keys

      Returns number[]

    • Proceed single block of data using Magma cipher

      Parameters

      • block: Uint8Array

        Block

      • sequence: number[]

        Sequence of K_i S-Box applying

      Returns Uint8Array

      Proceeded block

      Block size is invalid or data is too short

    • Regenerate round keys for sequence

      Parameters

      • sequence: number[]

      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

    • Backward compatibility block preparation for 28147-89

      Parameters

      • data: Uint8Array

      Returns Uint8Array

    • Backward compatibility key preparation for 28147-89 key schedule

      Parameters

      • key: Uint8Array

      Returns Uint8Array

    • Convert uint32 number to bytes

      Parameters

      • value: number

      Returns Uint8Array