buffer_sha1

Create a sha1 hash for the given buffer.

Syntax:

GML Code Example

buffer_sha1(buffer, offset, size);


Argument Description
buffer The index of the buffer to use.
offset The data offset value.
size The size of the buffer.


Returns: String


Description

In cryptography, SHA-1 is a cryptographic hash function designed by the United States National Security Agency and is employed in several widely used applications and protocols like the popular Git where it is used to check for file changes. This function will take input data from a buffer and returns a 160 bit message digest in ASCII format. 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). When applying this to buffers using this function you must specify the buffer id of the buffer to use, then an offset value (in bytes) for where to begin, and then a size (again in bytes) for the region to be hashed.


Example:

GML Code Example

check_string = buffer_sha1(buff, 0, buffer_get_size(buff));

The above code will create a sha1 hash for the full data stored in the buffer indexed by the variable "buff", and store the returned hash in the variable "check_string".





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