Skip to content

Commit

Permalink
Object 113
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jan 5, 2025
1 parent 5e2959c commit c8b68c2
Show file tree
Hide file tree
Showing 32 changed files with 17 additions and 145 deletions.
45 changes: 0 additions & 45 deletions cc/projects/luajit/CMakeLists.txt

This file was deleted.

45 changes: 0 additions & 45 deletions cc/projects/zlib/CMakeLists.txt

This file was deleted.

File renamed without changes.
5 changes: 5 additions & 0 deletions lua/fittencode/cc/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
local M = {}

M.hash = function() return require("fittencode.cc.projects.hash") end

return M
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions lua/fittencode/cc/projects/hash/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package.cpath = package.cpath .. ';' .. require('cpath')

local _, CC = pcall(require, 'hash')
if not _ then
return
end

return CC
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
45 changes: 0 additions & 45 deletions lua/fittencode/hash/cc/CMakeLists.txt

This file was deleted.

14 changes: 4 additions & 10 deletions lua/fittencode/hash/cc/init.lua → lua/fittencode/hash/hash.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
package.cpath = package.cpath .. ';' .. require('cpath')

local _, C = pcall(require, 'hash')
if not _ then
return
end

local CC = require("fittencode.cc").hash()
local Fn = require('fittencode.fn')

local M = {}

function M.is_supported(method)
return C[string.lower(method)]
return CC[string.lower(method)]
end

function M.hash(method, plaintext, on_success, on_error)
if not M.is_supported(method) then
Fn.schedule_call(on_error)
return
end
local _, ciphertext = pcall(C[string.lower(method)], plaintext)
local _, ciphertext = pcall(CC[string.lower(method)], plaintext)
if _ then
Fn.schedule_call(on_success, ciphertext)
else
Fn.schedule_call(on_error)
end
end

return M
return M
Empty file added lua/fittencode/http/libcurl.lua
Empty file.

0 comments on commit c8b68c2

Please sign in to comment.