473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

calculating sha1sum

Hello,
I'm writing a C program that needs to calculate sha1sum of files on
Linux. Is it better to do this by using the already available
sha1sum(1) by using system call, or to use a library that provides
sha1sum implementation ? If the latter, can anyone give me pointer
where to I find such library ? (I tried Google but haven't found
anything).

Thank you.
RDB
Dec 16 '07 #1
2 2921
reubendb wrote, On 16/12/07 13:54:
Hello,
I'm writing a C program that needs to calculate sha1sum of files on
Linux. Is it better to do this by using the already available
sha1sum(1) by using system call, or to use a library that provides
sha1sum implementation ? If the latter, can anyone give me pointer
where to I find such library ? (I tried Google but haven't found
anything).
I believe in as much as possible using library rather than using the
system function to call an external program. Either way is non-portable
(system is part of standard C but the programs you invoke through it are
not).

You can write a sha implementation yourself in standard C, but
personally I would use a well known and maintained library for anything
cryptographic, after all why risk me introducing bugs when I can use
something written (or peer reviewed) by experts?

If you do want to write it yourself hen google for "sha1 rfc" to get the
definition and post your attempt here. Otherwise any decent
cryptographic library should include sha1, I know openssl does for
instance. However, the cryptographic libraries are off topic here.
--
Flash Gordon
Dec 16 '07 #2
reubendb wrote:
Hello,
I'm writing a C program that needs to calculate sha1sum of files on
Linux. Is it better to do this by using the already available
sha1sum(1) by using system call, or to use a library that provides
sha1sum implementation ? If the latter, can anyone give me pointer
where to I find such library ? (I tried Google but haven't found
anything).
It is better to use a library for this. Almost every crypt library on
the planet, comes with SHA-1 module, so it shouldn't be hard to find at all.

FYI, a search for "sha1.c" gave me ca. 75.000 google hits!

--
Tor <bw****@wvtqvm.vw | tr i-za-h a-z>
Dec 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
12
by: Ola Natvig | last post by:
Hi all Does anyone know of a fast way to calculate checksums for a large file. I need a way to generate ETag keys for a webserver, the ETag of large files are not realy nececary, but it would be...
0
by: Kasp | last post by:
Hi there, I am trying to make an OLAP cube on a table having two columns (datetime, Number_of_times_an_event_occured). My dimension is time and I want to measure the Min and Max times an event...
1
by: Joe Bongiardina | last post by:
What does the message "calculating...." mean in the lower left status area of a form? I have a form with no calculated, concatenated or lookup fields, yet it displays this msg. The form takes...
1
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on...
0
by: robin9876 | last post by:
In an Access 2000 database on some forms 'Calculating...' is continuously displayed in the status bar window and the text of the control is automatically selected. The only workaround is switching...
5
by: sugaray | last post by:
Hi, my problem with calculating the size of an array is when I pass an array as a parameter to a function which perform the calculation, the result never comes right, like below: int...
25
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for...
1
by: laredotornado | last post by:
Hi, Can anyone recommend a free script for calculating UPS shipping? I am familiar with the script written in 2000 by Jason Costomiris, but UPS is using an XML interface and I wondered if...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.