我的代码是这样的
#sha256加密
if arg_0 == "sha256" && arg_1 == "en"
then enc = OpenSSL::Digest::SHA256.digest(arg_2)
p File.join(enc)
puts File.join(enc)
puts File.join(enc).to_i(16)
puts enc.to_i(16)
end
请问为什么输出是这样的
G:Ruby_pojpoj_1>ruby sha256.rb sha en admin
"x8CivxE5xB5Ax04x15xBDxE9bxBDMxEEx15xDFxB1gxA9xC8sxFCKxB8xA8x
1Fo*xB4HxA9x18"
�iv��A��M���g��s�K��o*�H�
0
0
我实际想要是结果是这种
8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
请问应该怎么写?
ringa_lee2017-04-24 16:02:37
Is it ruby? The grammar doesn’t feel very similar
If it is ruby, try the following code using irb
require 'digest'
Digest::SHA256.hexdigest 'message'
Please refer to http://ruby-doc.org/stdlib-2.1.0/libdoc/digest/rdoc/Digest.html