TeaDecode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Example update)
mNo edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server_client function}}
{{Server_client function}}
{{New feature/item|9.06056|1.3.5|6056|
{{New feature/item|3.0135|1.3.5|6056|
This function decrypts given [https://en.wikipedia.org/wiki/Base64 base64] representation of encrypted data using the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm].
This function decrypts given [https://en.wikipedia.org/wiki/Base64 base64] representation of encrypted data using the [https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm Tiny Encryption Algorithm].
}}
}}

Revision as of 23:00, 4 August 2014

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

Syntax

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

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

Example

Click to collapse [-]
Example 1

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

[lua]
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 ) )
    else
        outputChatBox( "Syntax: /" .. cmd .. " [string] [key]" )
    end
end
addCommandHandler( "teadecrypt", decryptString )

See Also