#!/bin/sh
if [ -z "$1" ]; then echo "execute $0 file"; exit 1; fi
realm="lighttpd"
out=""
while read -r line; do
	user=$(echo $line | awk '{print $1}')
	pass=$(echo $line | awk '{print $2}')
	if [ -z "$pass" ]; then out="$out$user\n"; continue; fi
	hash=$(echo -n "$user:$realm:$pass" | md5sum | cut -b -32)
	out="$out$user:$realm:$hash\n"
	user=""
	pass=""
done < $1
echo -e $out > $1
modsave flash
