Q: How do I test Digest::SHA2.hexdigest in online irb? I want to see the hash created by the function Digest::SHA2.hexdigest. I do not have Ruby installed, so I went for the online irb. Typing
Digest::SH­A2.hexdige­st("hello"­)

gives
=> #<NameError: uninitialized constant Digest>

Is it possible to add the needed library in any online irb?

A: You need to do as below :
2.0.0-p0 :003 > require 'digest'
 => true 
2.0.0-p0 :004 > Digest::SHA2.hexdigest("hello")
 => "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" 
2.0.0-p0 :005 > 

So do first require 'digest'.
Try in tutorialspoint

