iterations > 2 makes method call bin_string to fail
archanasingh opened this issue · 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.
Hey guys, this has been open for over a year... why isn't it either fixed or closed or something?
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.
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'
The code on github should work; I don't control the rubygems.org entry, so can't help you there.
-sq