MCPcopy Create free account
hub / github.com/defold/defold / HashToHex

Function HashToHex

engine/script/src/script_hash.cpp:121–132  ·  view source on GitHub ↗

get hex representation of a hash value as a string * Returns a hexadecimal representation of a hash value. * The returned string is always padded with leading zeros. * * @name hash_to_hex * @param h [type:hash] hash value to get hex string for * @return hex [type:string] hex representation of the hash * @examples * * ```lua * local h = hash("my_has

Source from the content-addressed store, hash-verified

119 * ```
120 */
121 static int HashToHex(lua_State* L)
122 {
123 int top = lua_gettop(L);
124
125 dmhash_t hash = dmScript::CheckHash(L, 1);
126 char buf[17];
127 dmSnPrintf(buf, sizeof(buf), "%016llx", (unsigned long long)hash);
128 lua_pushstring(L, buf);
129
130 assert(top + 1 == lua_gettop(L));
131 return 1;
132 }
133
134 static int HashMD5(lua_State* L)
135 {

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
CheckHashFunction · 0.85
dmSnPrintfFunction · 0.85
lua_pushstringFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected