Skip to content

SHA256_PassHash #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions amx/server/syscalls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function argsToMTA(amx, prototype, ...)
val = amx.dbresults[val]
elseif vartype == 'a' then -- 3D text label
val = amx.textlabels[val]
elseif vartype == 'y' then
elseif vartype == 'y' then -- Actor
val = g_Actors[val] and g_Actors[val].elem
end
if val == nil then
Expand Down Expand Up @@ -2917,6 +2917,13 @@ function AttachCameraToObject(amx, player, object)
clientCall(player, 'AttachCameraToObject', object)
end

-- Security

function SHA256_PassHash(amx, pass, salt, ret_hash, ret_hash_len)
local secret = hash ( 'sha256', salt .. '' .. pass )
writeMemString(amx, ret_hash, string.upper(secret) )
end

-----------------------------------------------------
-- List of the functions and their argument types

Expand Down Expand Up @@ -3492,5 +3499,8 @@ g_SAMPSyscallPrototypes = {
SetActorHealth = {'y', 'f'},
SetActorInvulnerable = {},
SetActorPos = {'y', 'f', 'f', 'f'},
SetActorVirtualWorld = {'y', 'i'}
SetActorVirtualWorld = {'y', 'i'},

-- security
SHA256_PassHash = {'s', 's', 'r', 'r'}
}