Home > Back-end >  Strives for the guidance, the inside of the C program run openssl functions have no reaction
Strives for the guidance, the inside of the C program run openssl functions have no reaction

Time:04-09

Just installed openssl - 1.1.1 f, want to run a hash function, the code is as follows:

#include
#include
#include


Int main (int arg c, char * * argv)
{
Printf (" hello world \ n ");
Unsigned char hash [SHA_DIGEST_LENGTH];
Unsigned char content [4096]={' \ x41 '};
Unsigned int len=4096;
Unsigned char * res=SHA1 (content, len, hash);
Printf (" digest=% s ", hash);
return 0;
}

Under the Windows CMD compiled using GCC, command GCC -o test test. The c - llibssl - llibcrypto

Results running exe program only print the hello world, exe window automatically shut down after a few seconds, try the SHA256 function is the same situation, can you tell me what's the problem?

CodePudding user response:

In the return 0; Adding a getc (); Have a try?

CodePudding user response:

reference 1st floor flying_music response:
in return 0; Adding a getc (); Have a try?
or not, a run into Openssl function is washed-up, SHA1 and SHA256 are tried, I use the powershell look into SHA1 () function, was dead

CodePudding user response:

reference qq_31101781 reply: 3/f
Quote: refer to 1st floor flying_music response:
in return 0; Adding a getc (); Have a try?
or not, a run into Openssl function is washed-up, SHA1 and SHA256 are tried, I use the powershell look into SHA1 () function, hangs dead

If has been hung up the function, it could be environmental problems, is bad to deal with the,,,

CodePudding user response:

Flying_music
reference 4 floor response:
Quote: refer to the third floor qq_31101781 response:
Quote: refer to 1st floor flying_music response:
in return 0; Adding a getc (); Have a try?
or not, a run into Openssl function is washed-up, SHA1 and SHA256 are tried, I use the powershell look into SHA1 () function, hangs dead

If has been hung up the function, it could be environmental problems, is bad to deal with the,,,
yes, I couldn't find where the problem is, when I install openssl is according to the online tutorials, install perl, nasm, vs2017, nmake, nmake test, nmake install to generate the library files,
  • Related