mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[chore] Update MD5 calls with new sha2 library (#6411)
Depends on <https://github.com/koreader/koreader-base/pull/1149>.
This commit is contained in:
@@ -5,7 +5,7 @@ A global LRU cache
|
||||
local DataStorage = require("datastorage")
|
||||
local lfs = require("libs/libkoreader-lfs")
|
||||
local logger = require("logger")
|
||||
local md5 = require("ffi/MD5")
|
||||
local md5 = require("ffi/sha2").md5
|
||||
|
||||
local CanvasContext = require("document/canvascontext")
|
||||
if CanvasContext.should_restrict_JIT then
|
||||
@@ -129,7 +129,7 @@ function Cache:check(key, ItemClass)
|
||||
end
|
||||
return self.cache[key]
|
||||
elseif ItemClass then
|
||||
local cached = self.cached[md5.sum(key)]
|
||||
local cached = self.cached[md5(key)]
|
||||
if cached then
|
||||
local item = ItemClass:new{}
|
||||
local ok, msg = pcall(item.load, item, cached)
|
||||
@@ -166,7 +166,7 @@ function Cache:serialize()
|
||||
|
||||
-- only dump cache item that requests serialization explicitly
|
||||
if cache_item.persistent and cache_item.dump then
|
||||
local cache_full_path = cache_path..md5.sum(key)
|
||||
local cache_full_path = cache_path..md5(key)
|
||||
local cache_file_exists = lfs.attributes(cache_full_path)
|
||||
|
||||
if cache_file_exists then break end
|
||||
|
||||
Reference in New Issue
Block a user