Permalink
Browse files

Remove MD5 support.

Closes #17317.
  • Loading branch information...
1 parent dedc6ae commit 1da2d5dd92dbe9baf7d6e047bcb7f39f06e9c52e @MikeMcQuaid MikeMcQuaid committed Jan 26, 2013
@@ -1,24 +0,0 @@
-#!/bin/sh
-# Change every formula's MD5 to a SHA1.
-
-HOMEBREW_PREFIX=$(brew --config | grep HOMEBREW_PREFIX | sed -e 's/HOMEBREW_PREFIX: //')
-cd $HOMEBREW_PREFIX/Library/Formula
-FORMULAE=$(grep "^ md5 " -rl . | sed -e 's/\.\///' -e 's/\.rb$//')
-
-for FORMULA in $FORMULAE
-do
- echo "Fetching and SHA1ing $FORMULA"
- if brew fetch $FORMULA &>/dev/null
- then
- SHA1=$(brew fetch $FORMULA | grep SHA1 | sed -e 's/SHA1: //')
- sed -i.old -e "s/^ md5 *[\"'][a-fA-F0-9]\{32\}[\"']/ sha1 '$SHA1'/" $FORMULA.rb
- rm $FORMULA.rb.old
- if !brew fetch $FORMULA &>/dev/null
- then
- echo "Error: SHA1ing $FORMULA failed, reverting"
- git checkout $FORMULA.rb
- fi
- else
- echo "Error: fetching $FORMULA failed, skipping"
- fi
-done
@@ -1,7 +1,7 @@
class Checksum
attr_reader :hash_type, :hexdigest
- TYPES = [:md5, :sha1, :sha256]
+ TYPES = [:sha1, :sha256]
def initialize type=:sha1, val=nil
@hash_type = type
@@ -244,13 +244,10 @@ def audit_specs
next if cksum.nil?
len = case cksum.hash_type
- when :md5 then 32
when :sha1 then 40
when :sha256 then 64
end
- problem "md5 is broken, deprecated: use sha1 instead" if cksum.hash_type == :md5
-
if cksum.empty?
problem "#{cksum.hash_type} is empty"
else
@@ -216,11 +216,6 @@ def incremental_hash(hasher)
incr_hash.hexdigest
end
- def md5
- require 'digest/md5'
- incremental_hash(Digest::MD5)
- end
-
def sha1
require 'digest/sha1'
incremental_hash(Digest::SHA1)
@@ -12,24 +12,6 @@ def bad_checksum f
end
end
- def test_md5
- valid_md5 = TestBall.new
- valid_md5.stable.instance_eval do
- md5 '060844753f2a3b36ecfc3192d307dab2'
- end
-
- good_checksum valid_md5
- end
-
- def test_badmd5
- invalid_md5 = TestBall.new
- invalid_md5.stable.instance_eval do
- md5 '61aa838a9e4050d1876a295a9e62cbe6'
- end
-
- bad_checksum invalid_md5
- end
-
def test_sha1
valid_sha1 = TestBall.new
valid_sha1.stable.instance_eval do
@@ -110,11 +110,8 @@ def test_formula_specs
assert_match /[0-9a-fA-F]{40}/, f.stable.checksum.hexdigest
assert_match /[0-9a-fA-F]{64}/, f.devel.checksum.hexdigest
- assert_nil f.stable.md5
assert_nil f.stable.sha256
- assert_nil f.bottle.md5
assert_nil f.bottle.sha256
- assert_nil f.devel.md5
assert_nil f.devel.sha1
assert_equal 1, f.stable.mirrors.length

0 comments on commit 1da2d5d

Please sign in to comment.