From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function decrypts given base64 representation of encrypted data using the Tiny Encryption Algorithm.

[[{{{image}}}|link=|]] Important Note: Use decodeString instead, because teaEncode inflates the file size by as high as ~77% (or by ~33% if the input isn't binary converted to base64 string).
[[{{{image}}}|link=|]] Important Note: teaDecode cannot handle binary data.


string teaDecode ( string data, string key )

Required Arguments

  • data: The block of data you want to decrypt
  • key: The key that should be used for decryption (Only first 16 characters are used)


Returns string containing the decrypted data if the decryption process was successfully completed, false otherwise.


Click to collapse [-]
Example 1

This example creates a /teadecrypt command, which reverts the TEA on a given string with the specified key.

function decryptString( cmd, theString, theKey )
    if ( theString ) and ( theKey ) then
        local decodedString = teaDecode( theString, theKey ) -- Decode the string with the key
        outputChatBox( "The decoded string is: " .. tostring( decodedString ) )
        outputChatBox( "Syntax: /" .. cmd .. " [string] [key]" )
addCommandHandler( "teadecrypt", decryptString )

See Also