Sha256: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Added min version requirements)
mNo edit summary
Line 25: Line 25:
function ( thePlayer, command, input )
function ( thePlayer, command, input )
if ( input ) then -- Check if the string exist
if ( input ) then -- Check if the string exist
local hash = sha256( input ) -- Generate the hash
local sha256hash = sha256( input ) -- Generate the hash
outputChatBox( hash ) -- Output the hash in the chat
outputChatBox( sha256hash ) -- Output the hash in the chat
end
end
end
end

Revision as of 20:55, 4 November 2014

This template is no longer in use as it results in poor readability.

[[{{{image}}}|link=|]] Tip: 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.

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.

Requirements

Minimum server version 1.3.1-9.04836
Minimum client version 1.3.1-9.04836

Note: Using this feature 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" />

Example

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
		end
	end
)

See Also