diff options
author | Jason A. Donenfeld | 2019-01-03 02:11:14 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2019-01-03 02:12:16 +0100 |
commit | 7d87cd3a215976a480b3c71b017a191597e5cb44 (patch) | |
tree | 70d600e62e9aaacc34993cc169a46f05cbe10f0e /filters/email-libravatar.lua | |
parent | ui-shared: fix broken sizeof in title setting and rewrite (diff) | |
download | cgit-7d87cd3a215976a480b3c71b017a191597e5cb44.tar.gz cgit-7d87cd3a215976a480b3c71b017a191597e5cb44.zip |
filters: migrate from luacrypto to luaossl
luaossl has no upstream anymore and doesn't support OpenSSL 1.1, whereas luaossl is quite active. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'filters/email-libravatar.lua')
-rw-r--r-- | filters/email-libravatar.lua | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/filters/email-libravatar.lua b/filters/email-libravatar.lua index b0e2447..7336baf 100644 --- a/filters/email-libravatar.lua +++ b/filters/email-libravatar.lua | |||
@@ -3,15 +3,24 @@ | |||
3 | -- prefix in filters. | 3 | -- prefix in filters. |
4 | -- | 4 | -- |
5 | -- Requirements: | 5 | -- Requirements: |
6 | -- luacrypto >= 0.3 | 6 | -- luaossl |
7 | -- <http://mkottman.github.io/luacrypto/> | 7 | -- <http://25thandclement.com/~william/projects/luaossl.html> |
8 | -- | 8 | -- |
9 | 9 | ||
10 | local crypto = require("crypto") | 10 | local digest = require("openssl.digest") |
11 | |||
12 | function md5_hex(input) | ||
13 | local b = digest.new("md5"):final(input) | ||
14 | local x = "" | ||
15 | for i = 1, #b do | ||
16 | x = x .. string.format("%.2x", string.byte(b, i)) | ||
17 | end | ||
18 | return x | ||
19 | end | ||
11 | 20 | ||
12 | function filter_open(email, page) | 21 | function filter_open(email, page) |
13 | buffer = "" | 22 | buffer = "" |
14 | md5 = crypto.digest("md5", email:sub(2, -2):lower()) | 23 | md5 = md5_hex(email:sub(2, -2):lower()) |
15 | end | 24 | end |
16 | 25 | ||
17 | function filter_close() | 26 | function filter_close() |