md5_string_unicode

Returns an MD5 of the unicode format input string.

Syntax:

GML Code Example

md5_string_unicode(string)


Argument Description
string The string to hash.


Returns: String


Description

In cryptography, MD5 (Message-Digest algorithm 5) is a widely used cryptographic hash function with a 128-bit hash value and has been employed in a wide variety of security applications. It is also commonly used to check the integrity of files and strings. This function will take an input unicode string (which is 16bits for each char) and return the 32-character hexadecimal MD5 hash that is unique to that string. In this way you can generate a secure key which can be stored and used to check the integrity of the information being sent to (or received from) an external server (for example).

NOTE: There are two formats for the MD5 encoding, UTF-8 and unicode. Both are provided to facilitate communication with different server setups, but the most common to use is unicode.


Example:

GML Code Example

var hash, str;
 str = base64_encode(game_data);
 hash = md5_string_unicode(str);
 http_get("http://www.MacSweeneyGames.com/CatchTheHaggis/gamedata?hash=" + hash); http_get("http://www.MacSweeneyGames.com/CatchTheHaggis/gamedata?data=" + str);

The above code will base64 encode a string and then generate an MD5 hash. Finally, both the hash and the encoded string are sent to a server.


Next: md5_file



No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here