Hi,
I am new in ruby. I will give here one example in .NET. The same encryption data I need in ruby.
.Net Code-:
using (SHA1 sha = new SHA1CryptoServiceProvider())
{
byte[] computeHash = sha.ComputeHash(enc.GetBytes(plainText + "." +
ConfigKey));
}
First it will convert the string to byte array and then computehash will change to Sha1 array.It will give the result in an integer array.
The same result I need in ruby, because I have some custom logic to implement after this result.
Thanks
What I have tried:
What I tried for this in ruby .
def hash1()
computeencode = []
strhash = @plaintext.to_s() + "." + @configkey.to_s()
computeencode = strhash.bytes
end
This bytes are same as I receive through .NET.
Then I tried to get Sha1 data.
sha1=(Digest::SHA1.hexdigest(computeencode.to_s))
But this result is not matching as Sha1 result in .Net.