Help a beginner

G

Guille Lopez

Hi,

It seems my ruby version is not accepting:
OpenSSL::Digest::Digest.new('sha256')

It's showing the error: Unsupported digest algorithm (sha256).

The Framework trace is: /usr/local/lib/ruby/1.8/openssl/digest.rb:55:in
`initialize' (...)

My ruby version is: ruby 1.8.7 (2010-08-16 patchlevel 302)
[i686-darwin9]

If I do 'which ruby' tells me: /opt/local/bin/ruby

And I am using Mac OS X 10.5.8

What I am doing wrong? What I should do?

I will really appreciate any help, tip or advise.

Thanks in advance,

Guille.
 
B

botp

It seems my ruby version is not accepting:
OpenSSL::Digest::Digest.new('sha256')
It's showing the error: Unsupported digest algorithm (sha256).

probably not a ruby version problem, eg

$ rvm exec ruby -v -ropenssl -e "p OpenSSL::Digest::Digest.new('sha256')"
ruby 1.9.2dev (2010-07-11 revision 28618) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.9.2dev (2010-07-02 revision 28524) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.9.2dev (2010-05-31 revision 28117) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-linux]
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>

but i'm on linux.

try first in irb. see if you still get the error.
if not, some gem you're loading is screwed... require the gems one at
a time to capture the culprit..

best regards -botp
 
J

Jose Calderon-Celis

[Note: parts of this message were removed to make it a legal post.]

What gem are you wearing?
$ rvm list

rvm rubies

ree-1.8.7-2010.02 [ i386 ]
ruby-1.8.7-p302 [ i386 ]
=> ruby-1.9.2-p0 [ i386 ]

$ gem search openSSl -r

*** REMOTE GEMS ***

costan-tem_openssl (0.3.6)
jruby-jruby-openssl (0.5.0.4)
JRuby-OpenSSL (0.1 ruby)
jruby-openssl (0.7.2 ruby)
openssl-extensions (0.0.9 ruby)
openssl-nonblock (0.2.1 ruby)
pftg-jruby-openssl (0.5.3 ruby)
ruby-hmac-openssl (0.1.0 ruby)
tem_openssl (0.3.6 ruby)



Jose Calderon-Celis
5199906-7970
http://www.tm.com.pe/mensajes/



2010/12/16 botp said:
It seems my ruby version is not accepting:
OpenSSL::Digest::Digest.new('sha256')
It's showing the error: Unsupported digest algorithm (sha256).

probably not a ruby version problem, eg

$ rvm exec ruby -v -ropenssl -e "p OpenSSL::Digest::Digest.new('sha256')"
ruby 1.9.2dev (2010-07-11 revision 28618) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.9.2dev (2010-07-02 revision 28524) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.9.2dev (2010-05-31 revision 28117) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-linux]
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>

but i'm on linux.

try first in irb. see if you still get the error.
if not, some gem you're loading is screwed... require the gems one at
a time to capture the culprit..

best regards -botp
 
G

Guille Lopez

Thanks -botp and Jose.
I will try both paths and see what I get.

I will come back with the results.
 
B

Brian Candler

Try a more common digest, e.g.

ruby -ropenssl -e 'p OpenSSL::Digest::Digest.new("md5")'

If that works, then perhaps the version of openssl you have doesn't
support sha256.
 
G

Guille Lopez

Thanks again for the help.

Back at home (from work) I am trying all the possibilities you are
telling me.

All the ones with "rvm" I am not able to execute them as I don't have
Ruby Version Manager installed.

But I have done:
$ gem search openSSl -r

And it shows:
** REMOTE GEMS ***

jruby-openssl (0.7.2 ruby)
JRuby-OpenSSL (0.1 ruby)
openssl-extensions (0.0.9 ruby)
openssl-nonblock (0.2.1 ruby)
pftg-jruby-openssl (0.5.3 ruby)
ruby-hmac-openssl (0.1.0 ruby)
tem_openssl (0.3.6 ruby)

Also doing:
$ ruby -ropenssl -e 'p OpenSSL::Digest::Digest.new("md5")'

It works:
#<OpenSSL::Digest::Digest: d41d8cd98f00b204e9800998ecf8427e>

But the problen is that for the Gem I am trying to use (asin) I need the
sha256.

As Brian was saying, probably the problem is that the version of openssl
I have doesn't
support sha256. I am gonna try to fix that.

Thanks again for your help guys.
 
G

Guille Lopez

One last question: what is doing $ ruby -ropenssl -e 'p
OpenSSL::Digest::Digest.new("md5")' ?

Becuase if I try:

$ ruby -ropenssl -e 'p OpenSSL::Digest::Digest.new("sha256")'
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>

What does it mean?

Does it mean sha256 works?
 
B

botp

$ ruby -ropenssl -e 'p OpenSSL::Digest::Digest.new("sha256")'
#<OpenSSL::Digest::Digest:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>
Does it mean sha256 works?

yes. that is why you have to check one at a time wc gem is screwing openssl...

best regards -botp
 
P

Phillip Gawlowski

How I do that?

1. Write test case (i.e. a minimal script doing what you want as above).
2. Require the gems one after the other.
3. Note at which point the script fails, and narrow down the offender(s).


--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
G

Guille Lopez

Thanks Phillip, but what I am confused now is about how I require one
gem after the other? how do I control which gems are loaded?

right now if I take a look at my program's Gemfile, it's just:

source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'asin'

And thanks again for all the help.

And if I do:


*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.3, 2.1.2)
actionpack (3.0.3, 2.1.2)
activemodel (3.0.3)
activerecord (3.0.3, 2.1.2)
activeresource (3.0.3, 2.1.2)
activesupport (3.0.3, 2.3.9, 2.1.2)
arel (2.0.6)
asin (0.0.8)
bcrypt-ruby (2.1.2)
bson (1.1.4)
bson_ext (1.1.4)
builder (3.0.0, 2.1.2)
bundler (1.0.7)
capistrano (2.5.19, 2.5.0)
cgi_multipart_eof_fix (2.5.0)
commonwatir (1.6.7, 1.6.2)
configuration (1.2.0)
crack (0.1.8)
curb (0.7.8)
daemons (1.1.0, 1.0.10)
devise (1.1.5)
diff-lcs (1.1.2)
erubis (2.6.6)
fastthread (1.0.7, 1.0.1)
firewatir (1.6.7, 1.6.2)
gem_plugin (0.2.3)
hashie (0.4.0, 0.2.2)
heroku (1.14.9, 1.14.8)
highline (1.6.1, 1.5.0)
hoe (2.8.0, 2.7.0, 1.8.2)
httparty (0.6.1)
httpclient (2.1.5.2)
i18n (0.5.0)
imdb_party (0.3.0)
json_pure (1.4.6)
launchy (0.3.7)
mail (2.2.12)
mime-types (1.16)
mongo (1.1.4)
mongoid (2.0.0.beta.20)
mongrel (1.1.5)
mysql (2.8.1, 2.7)
mysql2 (0.2.6)
net-scp (1.0.4, 1.0.1)
net-sftp (2.0.5, 2.0.1)
net-ssh (2.0.23, 2.0.4)
net-ssh-gateway (1.0.1, 1.0.0)
nokogiri (1.4.4)
ParseTree (3.0.6, 3.0.2, 2.1.1)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.6)
rails (3.0.3, 2.1.2)
railties (3.0.3)
rake (0.8.7, 0.8.3)
rest-client (1.6.1)
rspec (2.3.0, 2.1.0, 1.1.11)
rspec-core (2.3.0, 2.1.0)
rspec-expectations (2.3.0, 2.1.0)
rspec-mocks (2.3.0, 2.1.0)
ruby2ruby (1.2.5, 1.2.1, 1.1.8)
ruby_parser (2.0.5)
rubyforge (2.0.4, 1.0.1)
rubygems-update (1.3.7)
RubyInline (3.8.6, 3.8.1)
rvm (1.1.5)
s4t-utils (1.0.4)
sake (1.0.15)
sexp_processor (3.0.5)
simple_form (1.3.0)
sqlite3-ruby (1.2.4)
sucker (1.1.3)
termios (0.9.4)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.23)
user-choices (1.1.6.1, 1.1.6)
warden (1.0.3)
will_paginate (3.0.pre2)
xml-simple (1.0.12, 1.0.11)
yayimdbs (0.1.9)
ZenTest (4.4.2, 4.4.0, 3.11.0)
 
P

Phillip Gawlowski

Thanks Phillip, but what I am confused now is about how I require one
gem after the other? how do I control which gems are loaded?

You add and remove require statements as necessary:

require "gem_file_to_be_required"
# require "inactive_gem"

;)

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top