M
Mythran
TechN00b said:I'm trying to write a quick commandline app that takes a string from the
commandline and returns a formatted md5 hash. Unfortunately the code
won't
comple and returns an error of "No accessible 'Main' method with an
appropriate signature was found"
Anyone have an idea what I need to do to fix this?
Thanks!
Full code follows:
-----------------------------------
Imports System
Imports System.Text
Imports System.Security.Cryptography
Module MD5Return
Function MD5hash(ByVal data() As Byte) As Byte()
' This is one implementation of the abstract class MD5.
Dim md5 As New MD5CryptoServiceProvider()
Dim result As Byte() = md5.ComputeHash(data)
Return result
End Function
Public Sub Main(ByVal args As Char())
Dim clearBytes, hashedBytes As Byte()
If (args Is Nothing OrElse args.Length = 0) Then
clearBytes = New UnicodeEncoding().GetBytes(args)
hashedBytes = MD5hash(clearBytes)
Console.Write(BitConverter.ToString(hashedBytes))
End If
End Sub
End Module
You Public Sub Main should read:
Public Shared Sub Main(ByVal args As String())
...
End Sub
Maybe even prepend it with the STAThread attribute too

Mythran
No, later this year...I hate that we aren't on top of