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

Note: returns an uppercase string, so make sure you string.upper() anything else you are checking against that has been sha256'd elsewhere.
[[{{{image}}}|link=]] Tip: The sha module and this function may conflict with eachother, if you use this function uninstall the module!
[[|link=]] Warning: It is strongly recommended to use passworldHash to hash passwords, because Sha256 is easily decodable.

Calculates the sha256 hash of the specified string.


string sha256 ( string str )

Required Arguments

  • str: the string to hash.


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


Minimum supported server 1.3.1-9.04836
Minimum supported client 1.3.1-9.04836
Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.3.1-9.04836" client="1.3.1-9.04836" />


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

See Also