Sha256

From Multi Theft Auto: Wiki
Revision as of 15:30, 21 December 2012 by UniOnDennis (talk | contribs) (Created page with "__NOTOC__ {{Server client function}} {{MessageBox| bordercolorhex = FF0000 | bordertype = dotted | bgcolorhex = CCCCFF | image = File:Dialog-information.png | tit...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Dialog-information.png Warning regarding the sha module

The sha module and this function may conflict with eachother, if you use this function uninstall the module!


Calculates the sha256 hash of the specified string.

Note: returns an uppercase string, so make sure you string.upper() anything else you are checking against that has been sha256'd elsewhere.

Syntax

string sha256 ( string str )

Required Arguments

  • str: the string to hash.

Returns

Returns the sha256 hash of the input string if successful, false otherwise.

Example

addCommandHandler ( "sha", -- Create a command
	function ( thePlayer, command, input )
		if ( input ) then -- Check if the string exist
			local hash = sha256( input ) -- Generate the hash
			outputChatBox( hash ) -- Output the hash in the chat
		end
	end
)

See Also