Check xerces-c source code
(http://xml.apache.org/xerces-c/apiDocs/Base64_8hpp-source.html)

-- dims


----- Original Message -----
From: Asanka Priyanjitih <[EMAIL PROTECTED]>
Date: Thu, 8 Jul 2004 09:58:06 +0600
Subject: how we can encode SHA-1 hash to Base64
To: [EMAIL PROTECTED]

















Hi Team 



 



 



I wrote a piece of code to generate a password digest. But
this is not complete one. After generating SHA-1 hash, we have to encode SHA-1
hash to Base64.If some one knows how can we do that using that libraries or
some other suitable method please tell me?



 



This is that my code 



 



#include
<openssl/sha.h>



 



#include <stdio.h>



#include <string.h>



#include <memory.h>



.



.



.



.



.



 



char* doPasswordDigest(char
*nonce,char *created,char *passwordin)



{



     
char* passwordout=NULL;



     
int para_size=0;



     
char* para_cat=NULL;



     
char* md_return=NULL;



     




     
/*para_cat==nonce + created + password*/



 



     
para_size=strlen(nonce)+strlen(created)+strlen(passwordin);



     
para_cat=(char*)malloc(para_size);



     
strcpy(para_cat,nonce);



     
strcat(para_cat,created);



     
strcat(para_cat,passwordin);



 



 



/*SHA1(para_cat,para_size,passwordwout)==SHA-1
( nonce + created + password ) */



     




passwordout
= (unsigned char*)malloc(20);



     
SHA1((const unsigned char*)para_cat,para_size,(unsigned char*)passwordout);



     




.



.



/*
I want to encode passwordout to Base64*/ 



.



.



.



.    




 



     




     
free(para_cat);



     
free(passwordout);



       




     
.



.



}



 



 



 



 



Thanks & Regards



 



 



G J Asanka Priyanjith



 



 



 



 



 







________________________________

--------------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential
information intended for a specific individual and purpose, and is
intended for the addressee only.  Any unauthorized disclosure, use,
dissemination, copying, or distribution of this message or any of its
attachments or the information contained in this e-mail, or the taking
of any action based on it, is strictly prohibited.  If you are not the
intended recipient, please notify the sender immediately by return
e-mail and delete this message.












-- 
Davanum Srinivas - http://webservices.apache.org/~dims/

Reply via email to