sha example link

For general discussion related FlowStone
Post Reply
Logado
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

sha example link

Post by Logado »

I saw on the forum an example on how to use the ruby SHA for encryption and decryption.I try to find again but not found. Can someone provide a link?
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: sha example link

Post by tulamide »

Never saw an example, but it is not too difficult. At first you need to grab the OpenSSL library from Ruby, since it is not part of Flowstone's Ruby. If you install it as described in the FS manual, you can afterwards access it using

Code: Select all

require 'openssl'

you can then access SHA (or MD) like so

Code: Select all

data = File.read('document')
sha256 = OpenSSL::Digest::SHA256.new
digest = sha256.digest(data)


Read more about it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Digest.html
"There lies the dog buried" (German saying translated literally)
Logado
Posts: 62
Joined: Tue Jan 06, 2015 5:42 pm

Re: sha example link

Post by Logado »

yeah in theory it's simple :) but my ruby show me only error, i try now compile ruby.
I hope this helps
found example, but here only generate hash,i need digital signature :? .
I understand that in any case it was hacked, but I want to understand how to use asynchronous key generation.
Attachments
Pure_Ruby_SHA1_%26_MD5_implementation_DWB-2013.fsm
(2.64 KiB) Downloaded 753 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: sha example link

Post by tulamide »

Logado wrote:...but I want to understand how to use asynchronous key generation.

You really need Ruby's OpenSSL implementation. It's all in there. See http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL.html

Regarding installation: You not only need to install Ruby's OpenSSL (not OpenSSL), you also need to install each dependency that is not already part of Ruby's standard installation. You do so by looking at any .rb of Ruby's OpenSSL and searching for each 'require'.

It is cumbersome, but not difficult. Maybe you should install a full Ruby 1.9.3 (that the version Flowstone uses). It will contain everything you need, and you could copypaste from there.
"There lies the dog buried" (German saying translated literally)
Post Reply