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

    byte[] to Binary

    I have a byte[] in c# that holds a SHA512 hash. I want to store the byte[] in a binary field in my MySQL and also in my MS SQL databases. What size do I need to make the binary field so that it is the exact size to hold the hash? I think there are 512 bits in 64 bytes. But I am not sure how this converts to binary.

    I need this correct so passwords don't get corrupted. I also don't want to waste space by making the field too big.

    Thank You.
    Last edited by Tealc; April 22nd, 2009 at 10:12 PM.

  2. #2
    Join Date
    Feb 2005
    Location
    Denmark
    Posts
    742

    Re: byte[] to Binary

    Edit: Misread your post.

    If the Hash is 64 bytes, you should be able to use binary(64).
    However if you are unsure, varbinary(max) doesn't waste "much" space, and doesn't save additional additional data
    Last edited by Alsvha; April 23rd, 2009 at 03:52 AM.

  3. #3
    Join Date
    Apr 2009
    Posts
    19

    Re: byte[] to Binary

    Ok thanks I will try 64.

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