Software /
code /
verse
Comparison
plugins/vcard_update.lua @ 392:cdea6a28369e
plugins: Use util.hashes instead of util.sha1
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 25 Aug 2015 18:03:10 +0200 |
parent | 380:0891b4e27766 |
child | 395:e86144a4eaa1 |
comparison
equal
deleted
inserted
replaced
391:b496f0262a3f | 392:cdea6a28369e |
---|---|
1 local verse = require "verse"; | 1 local verse = require "verse"; |
2 | 2 |
3 local xmlns_vcard, xmlns_vcard_update = "vcard-temp", "vcard-temp:x:update"; | 3 local xmlns_vcard, xmlns_vcard_update = "vcard-temp", "vcard-temp:x:update"; |
4 | 4 |
5 -- MMMmmmm.. hacky | 5 local sha1 = require("util.hashes").sha1; |
6 local ok, fun = pcall(function() return require("util.hashes").sha1; end); | |
7 if not ok then | |
8 ok, fun = pcall(function() return require("util.sha1").sha1; end); | |
9 if not ok then | |
10 error("Could not find a sha1()") | |
11 end | |
12 end | |
13 local sha1 = fun; | |
14 | 6 |
15 local ok, fun = pcall(function() | 7 local ok, fun = pcall(function() |
16 local unb64 = require("util.encodings").base64.decode; | 8 local unb64 = require("util.encodings").base64.decode; |
17 assert(unb64("SGVsbG8=") == "Hello") | 9 assert(unb64("SGVsbG8=") == "Hello") |
18 return unb64; | 10 return unb64; |