CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2009
    Posts
    26

    [RESOLVED] SHA1 Hash

    I'm writing a program that copies the contents of one file to another and I need to create a duplicate of those files that I copied and rename them into SHA-1 Hash.

    For Example:
    The SHA1 hash of the string "test.txt" = 4b6fcb2d521ef0fd442a5301e7932d16cc9f375a
    Attached Files Attached Files

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: SHA1 Hash

    And your Java question is?

    Judge a man by his questions, rather than his answers...
    Voltaire
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Apr 2009
    Posts
    26

    Re: SHA1 Hash

    Quote Originally Posted by dlorde View Post
    And your Java question is?

    Judge a man by his questions, rather than his answers...
    Voltaire
    Sorry, I didn't mention what I was looking for but right now my program runs as copying a text file to another text file. What I need to do is list the copied files into a manifest.txt and their file name changed to their SHA1 hash code.
    Hope this clears things.

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: SHA1 Hash

    I'm still not sure what your question is but if you need help in creating the SHA1 code then just google for "Java code SHA1", there's loads of example code available.

  5. #5
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: SHA1 Hash

    Quote Originally Posted by Backslash View Post
    Hope this clears things.
    Not really, no. You may know what you're talking about, but it doesn't mean we do. Instead of stating what you need to do, why not ask a specific question about whatever part you are stuck on or don't understand.

    If you ask a clear and specific question, someone might be able to give a clear and specific answer.

    Programming is an explanatory activity...
    R. Harper
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  6. #6
    Join Date
    Apr 2009
    Posts
    26

    Re: SHA1 Hash

    Okay my question is:
    How do convert a string into its SHA1 hash code?

  7. #7
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: SHA1 Hash

    Oh, well that's not too difficult - try this

    One can think effectively only when one is willing to endure suspense and to undergo the trouble of searching...
    J. Dewey
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  8. #8
    Join Date
    Apr 2009
    Posts
    26

    Re: SHA1 Hash

    Quote Originally Posted by dlorde View Post
    Oh, well that's not too difficult - try this

    One can think effectively only when one is willing to endure suspense and to undergo the trouble of searching...
    J. Dewey
    Thanks =P
    btw is that a script? its cool

  9. #9
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: SHA1 Hash

    Quote Originally Posted by Backslash View Post
    btw is that a script? its cool
    See LetMeGoogleThatForYou.com.

    It is better to have an approximate answer to the right question than an exact answer to the wrong one...
    J. Tukey
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured