Scripts

VB.NET Calculation MD5 Algorithm

https://msdn.microsoft.com/en-us/library/system.security.cryptography.md5(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

VB.NET Calculation SHA1 Algorithm

Definition of the functions necessary to implement MD5


Imports System.Security.Cryptography

…

'' Obtención de firma sha1

sha_str = Me.HashString(info_user_request.DS_MERCHANT_MERCHANTCODE & info_user_request.DS_IDUSER & info_user_request.DS_TOKEN_USER & info_user_request.DS_MERCHANT_TERMINAL & password)

sha_str = Replace(sha_str, "-", "")

info_user_request.DS_MERCHANT_MERCHANTSIGNATURE = sha_str

…

Private Function HashString(ByVal str As String) As String

Dim sha As SHA1 = New SHA1CryptoServiceProvider()

Dim hashedValue As String = String.Empty

Dim hashedData As Byte() = sha.ComputeHash(System.Text.Encoding.ASCII.GetBytes(str))



hashedValue = BitConverter.ToString(hashedData).ToLower()



Return hashedValue

End Function




                

C# Calculation MD5 Algorithm

https://msdn.microsoft.com/en-us/library/system.security.cryptography.md5(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2