From 862ec8a43c13b510c15ef61e57b99944965abc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bo=C3=9Flet?= Date: Sun, 20 Jan 2013 05:15:20 +0100 Subject: [PATCH] Reset digest instance before generating derived bytes --- lib/krypt/pkcs5/pbkdf2.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/krypt/pkcs5/pbkdf2.rb b/lib/krypt/pkcs5/pbkdf2.rb index fc0efbe..354268f 100644 --- a/lib/krypt/pkcs5/pbkdf2.rb +++ b/lib/krypt/pkcs5/pbkdf2.rb @@ -12,6 +12,7 @@ def initialize(digest) def generate(pwd, salt, iter, outlen) raise "outlen too large" if outlen > MAX_FACTOR * @block_size + @digest.reset num_blocks = (outlen.to_f / @block_size).ceil # enforces ASCII-8BIT String.new.tap do |result|