Click here to Skip to main content
15,891,428 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to code a c program to perform ripemd160 hash on a char array. But I cannot figure out how could I do it. Can anyone suggest a c code to do the following?

What I have tried:

I came across this function in OpenSSL but I cannot figureout how to use it
unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
                 unsigned char *md);
Posted
Updated 19-Mar-20 23:26pm

What about The Documentation[^]?


Looks you are unfamiliar with the documentese (you should fix that as soon as possible).

try
C
const char mystr = "My Beautiful String"; // first parameter is the input string
unsigned long len = strlen( mystr ); // 2nd parameter is the length of the input string
unsigned char myhash[20]; // 3rd parameter is the (output) hash array
RIPEMD160( (const unsigned char *)mystr, len, myhash);
 
Share this answer
 
v2
Comments
Asish6542165 20-Mar-20 5:29am    
can you explain to me the parameters of this function

" unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
unsigned char *md);"
CPallini 20-Mar-20 5:48am    
See my updated solution.
Have you considered reading the documentation: /docs/man1.0.2/man3/RIPEMD160.html[^] at all?
 
Share this answer
 
Comments
CPallini 20-Mar-20 5:26am    
Damn! :-D
Asish6542165 20-Mar-20 5:27am    
what does the 'unsigned long n' do in it.
phil.o 20-Mar-20 5:31am    
RIPEMD160() computes the RIPEMD-160 message digest of the n bytes at d and places it in md (which must have space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array.
OriginalGriff 20-Mar-20 5:39am    
Reading documentation is clearly not a strong suite here ... :sigh:
Richard MacCutchan 20-Mar-20 6:43am    
Trebor make strong suites. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900