SHA1 length of resulting hash

Discussion in 'ASP .Net' started by Dil via .NET 247, Aug 4, 2004.

  1. Fresher to .NET

    Aiming to produce a resulting hash of length 24 CHARACTERS, using MD5 or SHA1 Algorithms.
    According to the Class Libraries, the hash size for the SHA1 algorithm is 160 bits, and 128 bits for MD5.

    After generating the hash, I convert the byte result to a base64 String, and my resulting hash lengths are as below:

    MD5 - 24 characters
    SHA1 - 28 Characters

    Please can someone confirm that this is correct, as I am a little confused in believing that the MD5 hash length should be 16 characters (128 bits) and the SHA1 hash length should be 20 (160 bits) characters long.

    Is it possible to produce a hash length of a REQUIRED length size, without trimming the result of the hash?
    Is the conversion to base64 String correct?


    Would most appreciate any assistance and comments.
    Thank you.
    ----------------------------
    From: Dil

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>ab2i+C4Ps0SnN8ud3RR4Qg==</Id>
     
    Dil via .NET 247, Aug 4, 2004
    #1
    1. Advertisements

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. Al Murphy

    SHA1 hash generator in hex

    Al Murphy, Mar 2, 2004, in forum: Java
    Replies:
    5
    Views:
    28,641
    darkzak
    Jan 7, 2009
  2. =?iso-8859-1?q?Elmo_M=E4ntynen?=

    How can I get an sha1 hash in base32?

    =?iso-8859-1?q?Elmo_M=E4ntynen?=, Jul 23, 2005, in forum: Python
    Replies:
    2
    Views:
    1,233
    =?iso-8859-1?q?Elmo_M=E4ntynen?=
    Jul 24, 2005
  3. LMZ
    Replies:
    5
    Views:
    1,249
    Martin v. Löwis
    Apr 6, 2008
  4. LaundroMat

    Calculate sha1 hash of a binary file

    LaundroMat, Aug 6, 2008, in forum: Python
    Replies:
    7
    Views:
    1,109
    LaundroMat
    Aug 7, 2008
  5. Adam Tauno Williams
    Replies:
    2
    Views:
    1,118
    Stefan Behnel
    Dec 30, 2010
  6. rp
    Replies:
    1
    Views:
    875
    red floyd
    Nov 10, 2011
  7. Peter Skovgaard

    shorten SHA1-hash

    Peter Skovgaard, Aug 16, 2007, in forum: Ruby
    Replies:
    1
    Views:
    235
    Tom Werner
    Aug 16, 2007
  8. Srijayanth Sridhar
    Replies:
    19
    Views:
    1,017
    David A. Black
    Jul 2, 2008
Loading...