generateKeyPair
Client-side
Server-side
Shared
Needs checking
This function was partially migrated from the old wiki. Please review manually:
- Missing section: Options for each hashing algorithm
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
This function creates a new public key and private key for encrypting data
Syntax
generateKeyPair ( )Code Examples
server
addCommandHandler("generatekeypair", function(player, _, algorithm, keysize) if algorithm then if keysize and tonumber(keysize) then local privateKey, publicKey = generateKeyPair( algorithm, { size = keysize } ) if not privateKey then outputChatBox("Failed to generate key pair. Make sure that all arguments are valid.", player, 255, 0, 0) else outputConsole("Private Key: " .. base64Encode(privateKey),player) outputConsole("Public Key: " .. base64Encode(publicKey),player) outputChatBox("The key pair was successfully generated. You can find the result in the console.", player, 0, 255, 0) end else outputChatBox("Please specify key size in the command.", player, 255, 0, 0) end else outputChatBox("Please specify algorithm in the command.", player, 255, 0, 0) end end)See Also
Utility Functions
- addDebugHook
- bitAnd
- bitArShift
- bitExtract
- bitLRotate
- bitLShift
- bitNot
- bitOr
- bitReplace
- bitRRotate
- bitRShift
- bitTest
- bitXor
- createTrayNotification
- debugSleep
- decodeString
- deref
- downloadFile
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getFPSLimit
- getKeyboardLayout
- getLocalization
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getProcessMemoryStats
- getRealTime
- getServerIp
- getTickCount
- getTimerDetails
- getTimers
- gettok
- getUserdataType
- getVersion
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTimer
- isTimerPaused
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- ref
- removeDebugHook
- resetTimer
- setClipboard
- setDevelopmentMode
- setFPSLimit
- setTimer
- setTimerPaused
- setTransferBoxVisible
- setWindowFlashing
- sha256
- showCol
- showSound
- split
- teaDecode
- teaEncode
- tocolor
- toJSON
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub