May I know how to sha256 encrypt strings in ruby?

  question, ruby

My code is like this

#sha256 encryption
 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

May I ask why the output is like this?

G:Ruby_pojpoj_1>ruby sha256.rb sha en admin
“x8CivxE5xB5Ax04x15xBDxE9bxBDMxEEx15xDFxB1gxA9xC8sxFCKxB8xA8x
1Fo*xB4HxA9x18″
�iv��A��M���g��s�K��o*�H�
0
0

What I really want is this result

8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918

How should I write it?

Ruby? Feeling grammar is not very similar

If it is ruby, try the following code with irb

require 'digest'
 Digest::SHA256.hexdigest 'message'

Please refer tohttp://ruby-doc.org/stdlib-2.1.0/libdoc/digest/rdoc/Digest.html