Using java's implementation of MessageDigest on JRuby but it


#1

So I was just testing out JRuby seeing how well you can call java code
into it, and i wanted to use java’s implementation of MessageDigest
instead ruby’s. I ran this code.

require ‘java’
include_class ‘java.security.MessageDigest’

puts MessageDigest.get_instance(‘MD5’).digest(‘My Text Here’)

and it returns this:

no digest with arguments matching [class org.jruby.RubyString]

Looks like I can’t use a RubyString as an argument for it to hash? Do I
have to call a String from java? that doesn;t make much sense.