summaryrefslogtreecommitdiff
path: root/meta/3rd/OpenResty/library/resty/aes.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-08-13 01:23:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-08-13 01:23:32 +0800
commit04fa96b7c0abba4d7cca03ed12ff3b65b3912e01 (patch)
treec0c8a2c0e92d0580280f838ba475875c7f82a73c /meta/3rd/OpenResty/library/resty/aes.lua
parentc30c5c2e267f6917600afe4f19e1e0d674bad9c6 (diff)
downloadlua-language-server-04fa96b7c0abba4d7cca03ed12ff3b65b3912e01.zip
fix #1431
Diffstat (limited to 'meta/3rd/OpenResty/library/resty/aes.lua')
-rw-r--r--meta/3rd/OpenResty/library/resty/aes.lua75
1 files changed, 75 insertions, 0 deletions
diff --git a/meta/3rd/OpenResty/library/resty/aes.lua b/meta/3rd/OpenResty/library/resty/aes.lua
new file mode 100644
index 00000000..7e627ef6
--- /dev/null
+++ b/meta/3rd/OpenResty/library/resty/aes.lua
@@ -0,0 +1,75 @@
+---@meta
+
+local aes={}
+
+---@alias resty.aes.cipher.name
+---| '"ecb"'
+---| '"cbc"'
+---| '"cfb1"'
+---| '"cfb128"'
+---| '"cfb8"'
+---| '"ctr"
+---| '"gcm"'
+---| '"ofb"'
+
+---@alias resty.aes.cipher.size '128'|'192'|'256'
+
+---@class resty.aes.cipher : table
+---@field size resty.aes.cipher.size
+---@field cipher resty.aes.cipher.name
+---@field method userdata
+
+---@param size resty.aes.cipher.size # cipher size (default `128`)
+---@param cipher? resty.aes.cipher.name # cipher name (default `"cbc"`)
+---@return resty.aes.cipher?
+function aes.cipher(size, cipher) end
+
+---@class resty.aes.hash_table : table
+---@field iv string
+---@field method? fun(key:string):string
+
+---@class resty.aes.hash_cdata : userdata
+
+---@type table<string, resty.aes.hash_cdata>
+aes.hash = {}
+aes.hash.sha1={}
+aes.hash.md5={}
+aes.hash.sha224={}
+aes.hash.sha512={}
+aes.hash.sha256={}
+aes.hash.sha384={}
+
+---@alias resty.aes.hash resty.aes.hash_cdata|resty.aes.hash_table
+
+---@param key string encryption key
+---@param salt? string if provided, must be exactly 8 characters in length
+---@param cipher? resty.aes.cipher (default is 128 CBC)
+---@param hash? resty.aes.hash (default is md5)
+---@param hash_rounds? number (default: `1`)
+---@param iv_len? number
+---@param enable_padding? boolean (default: `true`)
+---
+---@return resty.aes?
+---@return string? error
+function aes:new(key, salt, cipher, hash, hash_rounds, iv_len, enable_padding) end
+
+---@class resty.aes : table
+local aes_ctx = {}
+
+--- Decrypt a string
+---
+---@param s string
+---@param tag? string
+---@return string? decrypted
+---@return string? error
+function aes_ctx:decrypt(s, tag) end
+
+
+--- Encrypt a string.
+---
+---@param s string
+---@return string? encrypted
+---@return string? error
+function aes_ctx:encrypt(s) end
+
+return aes \ No newline at end of file