--- functions-1.0.27	2011-02-21 12:30:38.680288222 +0000
+++ functions	2011-02-21 12:18:50.597829630 +0000
@@ -228,13 +228,13 @@
 	export DOWNLOAD_DEBS
 }
 
-check_md5 () {
-	# args: dest md5 size
-	local expmd5="$2"
+check_sha1 () {
+	# args: dest sha1 size
+	local expsha1="$2"
 	local expsize="$3"
-	relmd5=`md5sum < "$1" | sed 's/ .*$//'`
+	relsha1=`sha1sum < "$1" | sed 's/ .*$//'`
 	relsize=`wc -c < "$1"`
-	if [ "$expsize" -ne "$relsize" ] || [ "$expmd5" != "$relmd5" ]; then
+	if [ "$expsize" -ne "$relsize" ] || [ "$expsha1" != "$relsha1" ]; then
 		return 1
 	fi
 	return 0
@@ -242,7 +242,7 @@
 
 get () {
 	# args: from dest 'nocache'
-	# args: from dest [md5sum size] [alt {md5sum size type}]
+	# args: from dest [sha1sum size] [alt {sha1sum size type}]
 	local displayname
 	if [ "${2%.deb}" != "$2" ]; then
 		displayname="$(echo "$2" | sed 's,^.*/,,;s,_.*$,,')"
@@ -257,7 +257,7 @@
 			rm -f "$2"
 		else
 			info VALIDATING "Validating %s" "$displayname"
-			if check_md5 "$2" "$3" "$4"; then
+			if check_sha1 "$2" "$3" "$4"; then
 				return 0
 			else
 				rm -f "$2"
@@ -278,7 +278,7 @@
 		local order=3
 	fi
 	for a in $order; do
-		local md5="$(eval echo \${$a})"
+		local sha1="$(eval echo \${$a})"
 		local siz="$(eval echo \${$(( $a+1 ))})"
 		local typ="$(eval echo \${$(( $a+2 ))})"
 		local from
@@ -300,13 +300,13 @@
 
 		info RETRIEVING "Retrieving %s" "$displayname"
 		if ! just_get "$from" "$dest2"; then continue; fi
-		if [ "$md5" != "" ]; then
+		if [ "$sha1" != "" ]; then
 			info VALIDATING "Validating %s" "$displayname"
-			if check_md5 "$dest2" "$md5" "$siz"; then
-				md5=""
+			if check_sha1 "$dest2" "$sha1" "$siz"; then
+				sha1=""
 			fi
 		fi
-		if [ -z "$md5" ]; then
+		if [ -z "$sha1" ]; then
 			[ "$dest2" = "$dest" ] || mv "$dest2" "$dest"
 			case "$typ" in
 			    gz)  gunzip "$dest" ;;
@@ -442,10 +442,10 @@
 
 ################################################################## download
 
-get_release_md5 () {
+get_release_sha1 () {
 	local reldest="$1"
 	local path="$2"
-	sed -n '/^[Mm][Dd]5[Ss][Uu][Mm]/,/^[^ ]/p' < "$reldest" | \
+	sed -n '/^[Ss][Hh][Aa]1:$/,/^[^ ]/p' < "$reldest" | \
 		while read a b c; do
 			if [ "$c" = "$path" ]; then echo "$a $b"; fi
 		done | head -n 1
@@ -504,9 +504,9 @@
 	local totalpkgs=0
 	for c in $COMPONENTS; do
 		local subpath="$c/binary-$ARCH/Packages"
-		local bz2md="`get_release_md5 "$reldest" "$subpath.bz2"`"
-		local gzmd="`get_release_md5 "$reldest" "$subpath.gz"`"
-		local normmd="`get_release_md5 "$reldest" "$subpath"`"
+		local bz2md="`get_release_sha1 "$reldest" "$subpath.bz2"`"
+		local gzmd="`get_release_sha1 "$reldest" "$subpath.gz"`"
+		local normmd="`get_release_sha1 "$reldest" "$subpath"`"
 		local md=
 		if [ "$normmd" != "" ]; then
 			md="$normmd"
@@ -529,9 +529,9 @@
 	for c in $COMPONENTS; do
 		local subpath="$c/binary-$ARCH/Packages"
 		local path="dists/$SUITE/$subpath"
-		local bz2md="`get_release_md5 "$reldest" "$subpath.bz2"`"
-		local gzmd="`get_release_md5 "$reldest" "$subpath.gz"`"
-		local normmd="`get_release_md5 "$reldest" "$subpath"`"
+		local bz2md="`get_release_sha1 "$reldest" "$subpath.bz2"`"
+		local gzmd="`get_release_sha1 "$reldest" "$subpath.gz"`"
+		local normmd="`get_release_sha1 "$reldest" "$subpath"`"
 		local ext=
 		local md=
 		if [ "$normmd" != "" ]; then
@@ -588,13 +588,13 @@
 
 	$PKGDETAILS PKGS "$m" "$pkgdest" "$@" | (
 		leftover=""
-		while read p ver arc mdup fil md5 size; do
+		while read p ver arc mdup fil sha1 size; do
 			if [ "$ver" = "-" ]; then
 				leftover="$leftover $p"
 			else
 				progress_next "$(($dloaddebs + $size))"
 				local debdest="$($DLDEST deb "$p" "$ver" "$arc" "$m" "$fil")"
-				if get "$m/$fil" "$TARGET/$debdest" "$md5" "$size"; then
+				if get "$m/$fil" "$TARGET/$debdest" "$sha1" "$size"; then
 					dloaddebs="$(($dloaddebs + $size))"
 					echo >>$TARGET/debootstrap/debpaths "$p $debdest"
 				else
@@ -704,9 +704,9 @@
 				continue
 			fi
 			size="${details##* }"; details="${details% *}"
-			md5="${details##* }"; details="${details% *}"
+			sha1="${details##* }"; details="${details% *}"
 			local debdest="$($DLDEST deb $details)"
-			if get "$m/${details##* }" "$TARGET/$debdest" "$md5" "$size"; then
+			if get "$m/${details##* }" "$TARGET/$debdest" "$sha1" "$size"; then
 				echo >>$TARGET/debootstrap/debpaths "$p $debdest"
 				details="done"
 				break
@@ -1027,14 +1027,14 @@
 		$ver = $v if ($f eq "version:");
 		$arc = $v if ($f eq "architecture:");
 		$fil = $v if ($f eq "filename:");
-		$md5 = $v if ($f eq "md5sum:");
+		$sha1 = $v if ($f eq "sha1:");
 		$siz = $v if ($f eq "size:");
 		$val = $v if ($f eq $field);
 	} elsif (/^$/) {
 		if (defined $val && defined $fields{$val}) {
 			$cnt++;
 			printf "%s %s %s %s %s %s %s\n",
-			 $pkg, $ver, $arc, $mirror, $fil, $md5, $siz;
+			 $pkg, $ver, $arc, $mirror, $fil, $sha1, $siz;
 			if ($unique) {
 				delete $fields{$val};
 				last if (--$cnt <= 0);
