i want to generate SHA1 hash of string in Linux (atmark) and downloaded the XYSSL-0.9 version code for the same.i have the algorithm which takes file as argument and returns hash of file . And of same file while I generated the key using online tools then it doesn't match with my compiled library's result.
Do I need to change anything for it while compiling.
Secondly the data is equivalent to while doing memcpy in function rsa_pkcs1_verify(). In this func len is 35 and hasd_id is RSA_SHA1.
is there any conversion required on string before giving to hash generator???
if yes in which form its required??
Can u please let me know the hashkey generated via sha1sum unix command will it be similar to the one generated by sha1 of xyssl library.
If not why there will be a difference.
I installed libxyssl-dev and it populated a directory with a number of examples. The one I found useful for this thread is a c code, uploaded (below) as a txt file. It is from:
I wote a quick perl code and compared a few other methods to calculate the sha1 hash. The results are:
Whole: 15:0:15 of 4 lines in file "data1"
Now is the time
for all good men
to come to the aid
of their country.
|| end
-----
Results, perl:
7de790fbe559d66cf890671ea2ef706281a1017f data1 (perl)
-----
Results, sha1sum:
7de790fbe559d66cf890671ea2ef706281a1017f data1
-----
Results, openssl OpenSSL 0.9.8g 19 Oct 2007:
SHA1(data1)= 7de790fbe559d66cf890671ea2ef706281a1017f
-----
Results, sample c code ( 156 lines ):
-rwxr-xr-x 1 26335 Jul 3 13:14 a.out
7de790fbe559d66cf890671ea2ef706281a1017f data1 (c code)
Your install will probably have placed relevant files in places different from those for my install.