Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
I am writing a program that creates MD5s. I want it to return same output as md5sum. I understand when I use md5sum like this: echo password | md5sum --text ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2004
    Location
    Stalk much?
    Posts
    19

    Getting MD5s


    I am writing a program that creates MD5s. I want it to return same output as md5sum.

    I understand when I use md5sum like this:

    echo password | md5sum --text

    i am taking them md5 of "password\n" correct? is there a null termination character md5ed or no?

    I am using Gcrypt and i t requires a character array buffer to be passed to it to parse. will it read the null characters in the buffer aswell?

    I want this to work:
    std::cin >> ptrto13chararray;
    dim passwordwithoutnullbutwithnewline[] as char = fixarray(ptrto13chararray);
    .
    i enter "password" in cin, i will end up with a character array that looks like:
    {'p','a','s','s','w','o','r','d','\0','','','',''} right? what is in those last few quotes, and will gcrypt parse it?

    how would I translate the above character array into
    {'p','a,'s','s','w','o','r','d','\n'}
    ?

    Or if you have an easier way to turn a password into an md5 in program please let me know.

  2. #2
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by zappacky
    I am writing a program that creates MD5s. I want it to return same output as md5sum.
    I'm just curious, why are you writing this program if md5sum gives you your desired input already?
    Registered Linux user #270181
    TechieMoe's Tech Rants

  3. #3
    Just Joined!
    Join Date
    Apr 2004
    Location
    Stalk much?
    Posts
    19
    its for a server. I cant use external programs

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Apr 2004
    Location
    Stalk much?
    Posts
    19
    external programs meaning anything not compiled into the server. So i dont care if i bring the binary or the source, unless it is built in to the server.

  6. #5
    Just Joined!
    Join Date
    Apr 2004
    Location
    Stalk much?
    Posts
    19
    ...I can easily compile things on the server. What i am saying is is i am NOT going to use something like execl("md5sum"...) or something like that. I am saying i want to be able to convert a null terminating string to a non null terminating string WITH a newline.

  7. #6
    Just Joined!
    Join Date
    Apr 2004
    Location
    Stalk much?
    Posts
    19
    that isnt the only thing this program does. that is just a small snippet. it is an entire server, this is just the password part. is it possible to use md5sum and get the stdoutted value?

  8. #7
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Aha. I completely misread your original post. You're asking how to do some character-by-character string manipulation in C?
    Registered Linux user #270181
    TechieMoe's Tech Rants

  9. #8
    Just Joined!
    Join Date
    Apr 2004
    Location
    Stalk much?
    Posts
    19
    I was, but I jsut read a few copyright statements and i have some more (nurelated) questions:

    If I make a program using GCC, can I sell it?
    If I use a library under GPL in a program, can I sell it?
    If I use sourcecode from a GPL program in my program, can I sell it?

    The reason I am asking is I am developing a game, but I would like to be able to make some money for a subscription to the game ( because servers are expensive and I need money)

  10. #9
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by zappacky
    I was, but I jsut read a few copyright statements and i have some more (nurelated) questions:

    If I make a program using GCC, can I sell it?
    If I use a library under GPL in a program, can I sell it?
    If I use sourcecode from a GPL program in my program, can I sell it?

    The reason I am asking is I am developing a game, but I would like to be able to make some money for a subscription to the game ( because servers are expensive and I need money)
    Yes, you can indeed sell software you create using GPL products, and if you use GPL-licensed libraries you *may* need to release your source code (I'm not a lawyer and this is a sticky area). There is no provision in the GPL that keeps you from charging for your software however.
    Registered Linux user #270181
    TechieMoe's Tech Rants

  11. #10
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    AFAIK, that's exactly correct, including the last part(if you include a GPL lib in your code, you must make your code GPL). There's nothing anywhere that stops you from making money from something you created yourself, with any GPL tool. It's when you start to include GPL stuff you *didn't* create that things start to get a little stickier, and that last condition seems to apply.

    DT

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •