summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/format.lua1
-rw-r--r--lib/fs.lua12
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/format.lua b/lib/format.lua
index 0b7b54b..1fa5fc6 100644
--- a/lib/format.lua
+++ b/lib/format.lua
@@ -148,4 +148,3 @@ function string_to_table ( text, delimiter)
return list
end
-
diff --git a/lib/fs.lua b/lib/fs.lua
index 2dec07c..feb7056 100644
--- a/lib/fs.lua
+++ b/lib/fs.lua
@@ -88,6 +88,18 @@ function md5sum_file ( path )
return checksum
end
+function md5sum_string ( str)
+ cmd = "/bin/echo -n " .. str .. "|/usr/bin/md5sum|cut -f 1 -d \" \" "
+ f = io.popen(cmd)
+ local checksum = {}
+ for line in f:lines() do
+ checksum[#checksum + 1] = line
+ end
+ f:close()
+ return checksum[1]
+end
+
+
-- iterator function for finding dir entries matching filespec (what)
-- starting at where, or currentdir if not specified.