Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'SHA-512
- Public Function EncryptSHA512Managed(ByVal rawstring As String) As String
- Dim sha512 As System.Security.Cryptography.SHA512 = New System.Security.Cryptography.SHA512Managed()
- Dim sha512Bytes As Byte() = System.Text.Encoding.Default.GetBytes(rawstring)
- Dim cryString As Byte() = sha512.ComputeHash(sha512Bytes)
- Dim sha512Str As String = String.Empty
- For i As Integer = 0 To cryString.Length - 1
- sha512Str += cryString(i).ToString("X")
- Next
- Return sha512Str
- End Function
- 'MD5
- Public Function Md5FromString(ByVal rawString As String) As String
- Dim Bytes() As Byte
- Dim sb As New StringBuilder()
- If String.IsNullOrEmpty(rawString) Then
- Throw New ArgumentNullException
- End If
- Bytes = Encoding.Default.GetBytes(rawString)
- Bytes = MD5.Create().ComputeHash(Bytes)
- For x As Integer = 0 To Bytes.Length - 1
- sb.Append(Bytes(x).ToString("x2"))
- Next
- Return sb.ToString()
- End Function
- 'WILL ADD MORE IN THE FUTURE!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement