md5sum c function

Discussion in 'C Programming' started by Udai Kiran, Nov 12, 2007.

  1. Udai Kiran

    Udai Kiran Guest

    Hi all,
    I have been looking for a c function that can calculate md5sum of
    file given the path of the file. I know that the md5sum utility is
    included in gnu coreutils. but how can I use this as a function. Is
    there any library that can do this for me.
    Thanks in advance.
    udai.
    http://s.udaykiran.googlepages.com/
    Udai Kiran, Nov 12, 2007
    #1
    1. Advertising

  2. Udai Kiran

    Mark Bluemel Guest

    Udai Kiran wrote:
    > Hi all,
    > I have been looking for a c function that can calculate md5sum of
    > file given the path of the file. I know that the md5sum utility is
    > included in gnu coreutils. but how can I use this as a function. Is
    > there any library that can do this for me.
    > Thanks in advance.
    > udai.
    > http://s.udaykiran.googlepages.com/
    >

    Google and Wikipedia got me a solution in moments. Probably quicker than
    posting to a newsgroup and waiting for a response...
    Mark Bluemel, Nov 12, 2007
    #2
    1. Advertising

  3. Udai Kiran

    Guest

    On Nov 12, 4:55 pm, Mark Bluemel <> wrote:
    > Udai Kiran wrote:
    > > Hi all,
    > > I have been looking for a c function that can calculate md5sum of
    > > file given the path of the file. I know that the md5sum utility is
    > > included in gnu coreutils. but how can I use this as a function. Is
    > > there any library that can do this for me.
    > > Thanks in advance.
    > > udai.
    > >http://s.udaykiran.googlepages.com/

    >
    > Google and Wikipedia got me a solution in moments. Probably quicker than
    > posting to a newsgroup and waiting for a response...


    You can use the system() function prototyped in the stdlib.h. in the C
    library. It can invoke any executable file/script in the file system.
    You can also pass appropriate commands line parameters.
    , Nov 12, 2007
    #3
  4. Udai Kiran

    Mark Bluemel Guest

    wrote:
    > On Nov 12, 4:55 pm, Mark Bluemel <> wrote:
    >> Udai Kiran wrote:
    >>> Hi all,
    >>> I have been looking for a c function that can calculate md5sum of
    >>> file given the path of the file. I know that the md5sum utility is
    >>> included in gnu coreutils. but how can I use this as a function. Is
    >>> there any library that can do this for me.
    >>> Thanks in advance.
    >>> udai.
    >>> http://s.udaykiran.googlepages.com/

    >> Google and Wikipedia got me a solution in moments. Probably quicker than
    >> posting to a newsgroup and waiting for a response...

    >
    > You can use the system() function prototyped in the stdlib.h. in the C
    > library. It can invoke any executable file/script in the file system.
    > You can also pass appropriate commands line parameters.


    And that helps the original poster precisely how?

    I would assume he wishes to use the md5sum for a file within
    his code. Running an external program doesn't move him forward
    very far, as far as I can see.
    Mark Bluemel, Nov 12, 2007
    #4
  5. Udai Kiran

    santosh Guest

    In article <>,
    <> wrote on Monday 12 Nov 2007
    8:56 pm:

    > On Nov 12, 4:55 pm, Mark Bluemel <> wrote:
    >> Udai Kiran wrote:
    >> > Hi all,
    >> > I have been looking for a c function that can calculate md5sum of
    >> > file given the path of the file. I know that the md5sum utility is
    >> > included in gnu coreutils. but how can I use this as a function.
    >> > Is there any library that can do this for me.
    >> > Thanks in advance.
    >> > udai.
    >> >http://s.udaykiran.googlepages.com/

    >>
    >> Google and Wikipedia got me a solution in moments. Probably quicker
    >> than posting to a newsgroup and waiting for a response...

    >
    > You can use the system() function prototyped in the stdlib.h. in the C
    > library. It can invoke any executable file/script in the file system.
    > You can also pass appropriate commands line parameters.


    Using system() makes your code inherently non-portable. In particular
    consider that not all systems come with an md5sum utility
    pre-installed, example Windows.

    While it may sometimes be necessary in this particular case it pretty
    easy to use any one of the several public implementations of an md5sum
    function, after noting the license.
    santosh, Nov 12, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Vanns
    Replies:
    7
    Views:
    7,030
    Evan Carew
    Jan 21, 2004
  2. Ben Rf
    Replies:
    4
    Views:
    620
    Christos TZOTZIOY Georgiou
    Mar 7, 2005
  3. Andrew Chalk

    md5sum differs across builds

    Andrew Chalk, Aug 23, 2005, in forum: C++
    Replies:
    1
    Views:
    356
    Victor Bazarov
    Aug 23, 2005
  4. Robert Lynch
    Replies:
    0
    Views:
    133
    Robert Lynch
    Jul 17, 2003
  5. David Filmer
    Replies:
    2
    Views:
    122
    Martijn Lievaart
    Nov 21, 2007
Loading...

Share This Page