Sha256: 11d9428444025576973821cdf90c58e81a6d9a0055f55084f0b0d0783774a005

Contents?: true

Size: 282 Bytes

Versions: 2

Compression:

Stored size: 282 Bytes

Contents

require 'base64'
require 'openssl'

module SJCL
  module Misc

    def self.pbkdf2(password, salt, iter, length)
      key = OpenSSL::PKCS5.pbkdf2_hmac(password, Base64.decode64(salt), iter, length/8, 'SHA256')
      SJCL::Codec::Hex.toBits(key.unpack('H*')[0])
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sjcl-1.0.1 lib/sjcl/pbkdf2.rb
sjcl-1.0.0 lib/sjcl/pbkdf2.rb