TeaEncode: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''data:''' The block of data you want to encrypt | *'''data:''' The block of data you want to encrypt | ||
*'''key:''' The key that should be used for encryption | *'''key:''' The key that should be used for encryption (Only first 16 characters are used) | ||
===Returns=== | ===Returns=== |
Revision as of 18:14, 22 July 2014
Syntax
string teaEncode ( string data, string key )
Required Arguments
- data: The block of data you want to encrypt
- key: The key that should be used for encryption (Only first 16 characters are used)
Returns
Returns the base64 representation of the encrypted data if the encryption process was successfully completed, false otherwise.
Example
Click to collapse [-]
ClientThis example creates a /teaencrypt command, which performs the TEA on a given string with the specified key, if any.
function encrypt(cmd, string, key) if string then if not key then key = string.rep(string.char(math.random(string.byte("a"), string.byte("Z"))), 10) -- Generate a random key of 10 characters end local encodedString = teaEncode(string, key) -- Encode the string with the key outputChatBox("The encoded string is: " .. encodedString .. " (used key: " .. key .. ")") else outputChatBox("Syntax: /" .. cmd .. " (string) [key].") end end addCommandHandler("teaencrypt", encrypt)
See Also
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace