ruby on rails - Can not append to OpenSSL Cipher -
i running bit of problem creating cipher, unusual thing if run script in irb or .rb file out side of ror application works fine.
heres script.
require 'openssl' require 'digest/sha1' cipher = openssl::cipher::cipher.new("bf-cbc").encrypt cipher.key_len = 16 cipher.key= "random encryption key*" v = cipher.random_iv.unpack("h*").first xs = ((cipher << digest::sha1.hexdigest("you@example.com")) + cipher.final).unpack("h*").first
error:
nomethoderror: undefined method `<<' openssl::cipher::cipher:0x007f800b60c920
i tried replacing << force , same error.
irb ruby: 1.8.7
application details ruby: 1.9.2 rails: 3.0.6
has encountered problem before?
the <<
method on cipher deprecated in 1.8.7 , removed in 1.9 (see docs). looks should using update
method instead.
at guess have multiple versions of ruby installed, in such way default version invoked 1.8.7, rails app running 1.9 or newer. because of .ruby-version file, .rvmrc file or because rails installed 1 of versions.
ruby-on-rails ruby openssl
No comments:
Post a Comment