我希望看到函数Digest::SHA2.十六摘要创建的散列。我没有安装Ruby,所以我选择了在线irb。打字
Digest::SHA2.hexdigest("hello")给出
=> #<NameError: uninitialized constant Digest>是否可以在任何在线irb中添加所需的库?
发布于 2013-12-29 21:09:35
你需要做的如下:
2.0.0-p0 :003 > require 'digest'
=> true
2.0.0-p0 :004 > Digest::SHA2.hexdigest("hello")
=> "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
2.0.0-p0 :005 > require 'digest'也是如此。
在tutorialspoint中尝试

https://stackoverflow.com/questions/20829996
复制相似问题