Difference between revisions of "love.data.hash"

m (https://bitbucket.org/rude/love/issues/1453)
m
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.
{{notice|There's [https://bitbucket.org/rude/love/issues/1453 bug] in version, up to [[11.2]] which gives wrong result for very-specific input length (112 + 128n for SHA512 and SHA384, 56 + 64n for other hash functions).}}
+
{{notice|There's [https://github.com/love2d/love/issues/1458 bug] in version, up to [[11.2]] which gives wrong result for very-specific input length (112 + 128n for SHA512 and SHA384, 56 + 64n for other hash functions).}}
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Revision as of 14:42, 18 April 2020

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.

O.png There's bug in version, up to 11.2 which gives wrong result for very-specific input length (112 + 128n for SHA512 and SHA384, 56 + 64n for other hash functions).  


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

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