Difference between revisions of "love.data.hash"
m |
m (Remove large "bug" notice, put it to notes.) |
||
Line 1: | Line 1: | ||
{{newin|[[11.0]]|110|type=function}} | {{newin|[[11.0]]|110|type=function}} | ||
Compute the message digest of a string using a specified hash algorithm. | Compute the message digest of a string using a specified hash algorithm. | ||
− | |||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
Line 19: | Line 18: | ||
{{param|string|rawdigest|Raw message digest string.}} | {{param|string|rawdigest|Raw message digest string.}} | ||
== Notes == | == Notes == | ||
+ | LOVE before [[11.3]] had a [https://github.com/love2d/love/issues/1458 bug] that gives wrong result for specific input length. | ||
+ | |||
+ | |||
To return the hex string representation of the hash, use [[love.data.encode]] | To return the hex string representation of the hash, use [[love.data.encode]] | ||
<source lang="lua"> | <source lang="lua"> |
Latest revision as of 11:15, 6 December 2022
Available since LÖVE 11.0 |
This function is not supported in earlier versions. |
Compute the message digest of a string using a specified hash algorithm.
Contents
Function
Synopsis
rawdigest = love.data.hash( hashFunction, string )
Arguments
HashFunction hashFunction
- Hash algorithm to use.
string string
- String to hash.
Returns
string rawdigest
- Raw message digest string.
Function
Synopsis
rawdigest = love.data.hash( hashFunction, data )
Arguments
HashFunction hashFunction
- Hash algorithm to use.
Data data
- Data to hash.
Returns
string rawdigest
- Raw message digest string.
Notes
LOVE before 11.3 had a bug that gives wrong result for specific input length.
To return the hex string representation of the hash, use love.data.encode
hexDigestString = love.data.encode("string", "hex", love.data.hash(algo, data))
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info