lib/blake/main.rb in blake-0.0.3 vs lib/blake/main.rb in blake-0.0.4

- old
+ new

@@ -95,12 +95,10 @@ [3, 4, 9, 14], ].freeze MASK64BITS = 0xFFFFFFFFFFFFFFFF - # private_class_method :new - def initialize(output_size = 512, salt = nil) self.output_size = output_size self.salt = salt if output_words <= 32 @@ -219,9 +217,13 @@ attr_reader :output_size, :salt def output_size=(value) unless value.is_a? Integer raise TypeError, "Expected #{Integer}, got #{value.class}" + end + + unless [224, 256, 384, 512].include? value + raise TypeError, 'unknown output size' end @output_size = value end