spec/aead/nonce_spec.rb in aead-1.6.1 vs spec/aead/nonce_spec.rb in aead-1.6.2

- old
+ new

@@ -64,11 +64,11 @@ threads.map(&:value).inject(&:+).length.must_equal(count * 5) end it 'must not allow the counter to roll over' do - self.state_file.open('w') do |io| + self.state_file.open('wb') do |io| io.write [ '1' * 12, '0' * 4, '%08x' % (subject.class::COUNTER_MAXIMUM_VALUE.hex - 5), ].pack(subject.class::PACK_FORMAT) @@ -92,19 +92,19 @@ end end it 'must abort when the nonce state file can be determined to be corrupt' do [1, 11, 13, 500].each do |count| - self.state_file.open('w') do |io| + self.state_file.open('wb') do |io| io.write SecureRandom.random_bytes(count) end lambda { subject.shift }.must_raise ArgumentError end end it 'must abort when the nonce contains the MAC for a different machine' do - self.state_file.open('w') do |io| + self.state_file.open('wb') do |io| io.write [ # FIXME: use ~MAC_MULTICAST_MASK, but figure out how to do so # reliably given Ruby's inability to do binary math correctly :( (SecureRandom.hex(6).hex & 0xfeffffffffff).to_s(16), SecureRandom.hex(2),