読者です 読者をやめる 読者になる 読者になる

VB.NET で SHA-512

Imports System.Text
Imports System.Security.Cryptography
 
Class Class1
 
    Public Shared Sub Main(ByVal args As String())
 
        Dim str = "test"
        If 0 < args.Length Then
            str = args(0)
        End If
 
        Dim sha512 As New SHA512CryptoServiceProvider()
        Dim bytes = sha512.ComputeHash(Encoding.GetEncoding("shift_jis").GetBytes(str))
 
        Dim printable As New StringBuilder()
        For Each b In bytes
            printable.AppendFormat("{0:x2}", b)
        Next
        Console.WriteLine(printable.ToString())
    End Sub
End Class