this is a C# gui using sha1 library in C from polarssl
how to create the C dll is posted in the C forum here:
https://techbliss.org/posts/3685/
to import the dll into the C# project, include the function prototype to be imported in the code for the gui
C prototype in sha1dll.h:
becomes this in C# project:
I put the prototype in frmSHA1.cs between:
and
in the gui project properties check the box to allow unsafe code
also the dll must be put in the same directory with the gui .exe
SHA1-GUI.zip contains the visual studio project.
how to create the C dll is posted in the C forum here:
https://techbliss.org/posts/3685/
to import the dll into the C# project, include the function prototype to be imported in the code for the gui
C prototype in sha1dll.h:
Code:
//_declspec(dllexport) int sha1_file( const char *path, unsigned char output[20] );
Code:
[DllImport("sha1dll.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
unsafe public extern static int sha1_file(string path, byte[] output);
I put the prototype in frmSHA1.cs between:
Code:
public frmSHA1()
{
InitializeComponent();
}
Code:
private void btnSha1_Click(object sender, EventArgs e)
{
...
also the dll must be put in the same directory with the gui .exe
SHA1-GUI.zip contains the visual studio project.
Attachments
Last edited: