403Webshell
Server IP : 62.60.133.156  /  Your IP : 216.73.217.51
Web Server : LiteSpeed
System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64
User : mimradmin ( 1166)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : OFF |  Pkexec : OFF
Directory :  /opt/imunify360-webshield/lualib/resty/openssl/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /opt/imunify360-webshield/lualib/resty/openssl/rand.lua
local ffi = require "ffi"
local C = ffi.C
local ffi_str = ffi.string

require "resty.openssl.include.rand"
local ctx_lib = require "resty.openssl.ctx"
local ctypes = require "resty.openssl.auxiliary.ctypes"
local format_error = require("resty.openssl.err").format_error
local OPENSSL_3X = require("resty.openssl.version").OPENSSL_3X

local buf
local buf_size = 0
local function bytes(length, private, strength)
  if type(length) ~= "number" then
    return nil, "rand.bytes: expect a number at #1"
  elseif strength and type(strength) ~= "number" then
    return nil, "rand.bytes: expect a number at #3"
  end
  -- generally we don't need manually reseed rng
  -- https://www.openssl.org/docs/man1.1.1/man3/RAND_seed.html

  -- initialize or resize buffer
  if not buf or buf_size < length then
    buf = ctypes.uchar_array(length)
    buf_size = length
  end

  local code
  if OPENSSL_3X then
    if private then
      code = C.RAND_priv_bytes_ex(ctx_lib.get_libctx(), buf, length, strength or 0)
    else
      code = C.RAND_bytes_ex(ctx_lib.get_libctx(), buf, length, strength or 0)
    end
  else
    if private then
      code = C.RAND_priv_bytes(buf, length)
    else
      code = C.RAND_bytes(buf, length)
    end
  end
  if code ~= 1 then
    return nil, format_error("rand.bytes", code)
  end

  return ffi_str(buf, length)
end

return {
  bytes = bytes,
}

Youez - 2016 - github.com/yon3zu