md5.sh 527 B

12345678910111213
  1. # try to find an md5 program
  2. if [ X"$(echo | md5sum -b 2> /dev/null)" != X ]; then
  3. do_md5sum() { md5sum -b $1; }
  4. elif [ X"$(echo | command md5 2> /dev/null)" != X ]; then
  5. do_md5sum() { command md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
  6. elif [ -x /sbin/md5 ]; then
  7. do_md5sum() { /sbin/md5 -r $1 | sed 's/\([0-9a-f]\) [ *]*/\1 */'; }
  8. elif openssl version >/dev/null 2>&1; then
  9. do_md5sum() { openssl md5 $1 | sed 's/MD5(\(.*\))= \(.*\)/\2 *\1/'; }
  10. else
  11. do_md5sum() { echo No md5sum program found; }
  12. fi