pbkdf2-ruby icon indicating copy to clipboard operation
pbkdf2-ruby copied to clipboard

iterations > 2 makes method call bin_string to fail

Open archanasingh opened this issue 14 years ago • 4 comments

it "should ensure that the derived key really is that long" do length = 123 p = PBKDF2.new(:password=>"s33krit", :salt=>"nacl", :iterations=>1000, :key_length=>length) p.bin_string.length.should == length end

The above test fails. Change iterations to 1 or 2 and test passes, anything greater than 2 makes this test to fail.

archanasingh avatar Jan 14 '12 19:01 archanasingh

Hey guys, this has been open for over a year... why isn't it either fixed or closed or something?

ehq avatar Apr 12 '13 15:04 ehq

This seems to be an encoding issue. The default encoding changed from ASCII-8BIT to utf8 in ruby 2. When i put:

# encoding: ASCII-8BIT

at the top of the pbkdf2.rb, then it seems to work again.

Ragmaanir avatar Aug 05 '13 15:08 Ragmaanir

Ok, this apparently has already been fixed, but the ruby-gems version does not contain the fix (though the bugfix is 1 year old). So i used:

gem 'pbkdf2', :git => 'git://github.com/emerose/pbkdf2-ruby.git'

Ragmaanir avatar Aug 05 '13 16:08 Ragmaanir

The code on github should work; I don't control the rubygems.org entry, so can't help you there.

-sq

emerose avatar Sep 16 '13 20:09 emerose