altcha-org/altcha

RuntimeError (Unsupported digest algorithm (SHA-256).: first num too large)

Closed this issue · 2 comments

Hi,

on my development server, the gem works fine, but on my production server I got the following error:

RuntimeError (Unsupported digest algorithm (SHA-256).: first num too large)

It seems there is some trouble with the name SHA-256

When I change line

  a.signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new(a.algorithm), Altcha.hmac_key, a.challenge)

to
a.signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, Altcha.hmac_key, a.challenge)

in altcha-rails.rb it works fine.

ovx commented

Hi, the problem is with the name, in JavaScript, the names contain dashes, but in Ruby, you have to use names without dashes (docs) so you'll have normalize the name before creating a digest.

ovx commented

Closing due to inactivity.