Is there a hash algorithm that produces a hash size of 64 bits in C#? -
i need produce hash value based off of variable length string can store within field no longer 16 (due vendor requirements).
i concatenating several strings being passed through c# script transformation in order calculate hash. constrained vendor's file specification in output of hash cannot longer 16.
does have suggestions? example string conversion of md5 algorith has length of 32.
the cryptographic has functions designed such may truncate output size , truncated hash function remains secure cryptographic hash function. example, if take first 128 bits (16 bytes) of output of sha-512 applied input, first 128 bits cryptographic hash strong other 128-bits cryptographic hash.
the solution choose cryptographic hash function - sha-256, sha-384, , sha-512 choices - , truncate output 128 bits (16 bytes).
--edit--
based on comment hash value must, when encoded ascii, fit within 16 asci characters, solution is
- first, choose cryptographic hash function (the sha-2 family includes sha-256, sha-384, , sha-512)
- then, truncate output of chosen hash function 96 bits (12 bytes) - is, keep first 12 bytes of hash function output , discard remaining bytes
- then, base-64-encode truncated output 16 ascii characters (128 bits)
- yielding 96-bit-strong cryptographic hash.
Comments
Post a Comment