Sha256: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (remove note box)
(Remove obsolete Requirements section)
 
(One intermediate revision by one other user not shown)
Line 15: Line 15:
===Returns===
===Returns===
Returns the sha256 hash of the input string if successful, ''false'' otherwise.
Returns the sha256 hash of the input string if successful, ''false'' otherwise.
==Requirements==
{{Requirements|1.3.1-9.04836|1.3.1-9.04836|}}


==Example==
==Example==
Line 33: Line 30:
==See Also==
==See Also==
{{Utility functions}}
{{Utility functions}}
[[en:sha256]]
[[ru:sha256]]

Latest revision as of 17:08, 7 November 2024

[[{{{image}}}|link=|]] Tip:
  • The sha module and this function may conflict with eachother, if you use this function uninstall the module!
  • This function returns an uppercase string, so make sure you string.upper() anything else you are checking against that has been sha256'd elsewhere.

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.

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