GAuth.

iwak

Известный
Автор темы
10
5
Версия MoonLoader
.027.0-preview
Приветствую всех, сразу к делу. Попытался воспользоваться полезной функцией(кликабельно), но ничего не получилось.
Код генерируется, но почему-то не такой, какой должен, время на ПК стоит автоматическое, отставание максимум 1 секунда.
Если что-то надо скинуть, обязательно дам, главное скажите что именно требуется.


GAuth.:
local sha1                        = require 'sha1'
local basexx                      = require 'basexx'

local skey = 'TESTtestTESTtest'

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end

  sampRegisterChatCommand('gauth', function()
    sampAddChatMessage(genCode(skey), -1)
  end)

  while true do
    wait(0)
  end
end

function genCode()
  if #skey >= 10 then
    skey = basexx.from_base32(skey)
    value = math.floor(os.time() / 30)
    value = string.char(
    0, 0, 0, 0,
    bit.band(value, 0xFF000000) / 0x1000000,
    bit.band(value, 0xFF0000) / 0x10000,
    bit.band(value, 0xFF00) / 0x100,
    bit.band(value, 0xFF))
    local hash = sha1.hmac_binary(skey, value)
    local offset = bit.band(hash:sub(-1):byte(1, 1), 0xF)
    local function bytesToInt(a,b,c,d)
      return a*0x1000000 + b*0x10000 + c*0x100 + d
    end
    hash = bytesToInt(hash:byte(offset + 1, offset + 4))
    hash = bit.band(hash, 0x7FFFFFFF) % 1000000
    return ('%06d'):format(hash)
  else return 0 end
end
 
Решение
Скопировал весь твой код - не получилось, код всё равно выдаётся неверным.
либы перекачай и синхронизируй время с интернетом +установи верный часовой пояс

CaJlaT

07.11.2024 14:55
Модератор
2,848
2,692
Lua:
local lsha1, sha1         = pcall(require, 'sha1') -- gauth
local lbasexx, basexx     = pcall(require, 'basexx') -- gauth
local band = bit.band
function genCode(skey)
    if lbasexx and lsha1 then
        skey = basexx.from_base32(skey)
        value = math.floor(os.time() / 30)
        value = string.char(
        0, 0, 0, 0,
        band(value, 0xFF000000) / 0x1000000,
        band(value, 0xFF0000) / 0x10000,
        band(value, 0xFF00) / 0x100,
        band(value, 0xFF))
        local hash = sha1.hmac_binary(skey, value)
        local offset = band(hash:sub(-1):byte(1, 1), 0xF)
        local function bytesToInt(a,b,c,d)
            return a*0x1000000 + b*0x10000 + c*0x100 + d
        end
        hash = bytesToInt(hash:byte(offset + 1, offset + 4))
        hash = band(hash, 0x7FFFFFFF) % 1000000
        return ('%06d'):format(hash)
    end
end

local skey = 'O64OHIOAMXRTXCWC'

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('gauth', function()
        sampAddChatMessage(genCode(skey), -1)
    end)

    while true do
        wait(0)
    end
end
 

iwak

Известный
Автор темы
10
5
Lua:
local lsha1, sha1         = pcall(require, 'sha1') -- gauth
local lbasexx, basexx     = pcall(require, 'basexx') -- gauth
local band = bit.band
function genCode(skey)
    if lbasexx and lsha1 then
        skey = basexx.from_base32(skey)
        value = math.floor(os.time() / 30)
        value = string.char(
        0, 0, 0, 0,
        band(value, 0xFF000000) / 0x1000000,
        band(value, 0xFF0000) / 0x10000,
        band(value, 0xFF00) / 0x100,
        band(value, 0xFF))
        local hash = sha1.hmac_binary(skey, value)
        local offset = band(hash:sub(-1):byte(1, 1), 0xF)
        local function bytesToInt(a,b,c,d)
            return a*0x1000000 + b*0x10000 + c*0x100 + d
        end
        hash = bytesToInt(hash:byte(offset + 1, offset + 4))
        hash = band(hash, 0x7FFFFFFF) % 1000000
        return ('%06d'):format(hash)
    end
end

local skey = 'O64OHIOAMXRTXCWC'

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('gauth', function()
        sampAddChatMessage(genCode(skey), -1)
    end)

    while true do
        wait(0)
    end
end
Скопировал весь твой код - не получилось, код всё равно выдаётся неверным.
 

CaJlaT

07.11.2024 14:55
Модератор
2,848
2,692
Скопировал весь твой код - не получилось, код всё равно выдаётся неверным.
либы перекачай и синхронизируй время с интернетом +установи верный часовой пояс
 
  • Нравится
Реакции: James Saula и iwak