From cd0c582c41acb719ef6590ab4ba63d66bdd7539d Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Wed, 30 Jan 2008 14:53:49 +0000 Subject: Updated the code to use md5sums in the acf passwd file. Made the md5sum_string function(to go along with md5sum_file) in fs git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@665 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lib/fs.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/fs.lua') 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. -- cgit v1.2.3