MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaRedisSha1hexCommand

Function luaRedisSha1hexCommand

app/redis-6.2.6/src/scripting.c:861–876  ·  view source on GitHub ↗

This adds redis.sha1hex(string) to Lua scripts using the same hashing * function used for sha1ing lua scripts. */

Source from the content-addressed store, hash-verified

859/* This adds redis.sha1hex(string) to Lua scripts using the same hashing
860 * function used for sha1ing lua scripts. */
861int luaRedisSha1hexCommand(lua_State *lua) {
862 int argc = lua_gettop(lua);
863 char digest[41];
864 size_t len;
865 char *s;
866
867 if (argc != 1) {
868 lua_pushstring(lua, "wrong number of arguments");
869 return lua_error(lua);
870 }
871
872 s = (char*)lua_tolstring(lua,1,&len);
873 sha1hex(digest,s,len);
874 lua_pushstring(lua,digest);
875 return 1;
876}
877
878/* Returns a table with a single field 'field' set to the string value
879 * passed as argument. This helper function is handy when returning

Callers

nothing calls this directly

Calls 5

sha1hexFunction · 0.85
lua_gettopFunction · 0.50
lua_pushstringFunction · 0.50
lua_errorFunction · 0.50
lua_tolstringFunction · 0.50

Tested by

no test coverage detected