1
$\begingroup$

i am working a prototype using some cryptographic properties. the question is simple but perhaps deep enough for me to decide :

sha256 is a strong hash function, but i have space for 248 bits only. my guess is if i remove any 8 bits the resulting mySHA248 will keep all good properties with slightly less entropy/collision resistance.

$\endgroup$
  • 1
    $\begingroup$ it's true for any subset of bits of any good cryptohash. If sha256 doesn't had this property, it will be never standardized by USA $\endgroup$ – Bulat Apr 26 at 7:52
1
$\begingroup$

You will get slightly more collisions, which is not a problem in many use cases, but overall hash properties are preserved.

If some hash loses its properties by omitting last few characters (or any selected ones), then hash is flawwed by having internal correlated structure.

In fact, NIST publication effectively trims hash to desired number of bits.

$\endgroup$
  • $\begingroup$ from NIST Special Publication 800-107 - 5.1.2. The λ left-most bits of the full-length message digest shall be selected as the truncated message digest. : That clarifies my 'if i remove ANY 8 bits' , ANY shall be 'right-most' bits. good to know ,thanks Evil $\endgroup$ – pogakl Apr 26 at 12:05
  • $\begingroup$ I didn't understand what you're saying in the second paragraph of your answer. $\endgroup$ – D.W. Apr 26 at 16:34
  • $\begingroup$ @D.W. Edited, I meant that hash bits should have uniform properties. If we have say 16bytes hash, and select say 12 bytes, it shouldn't matter which one are chosen, otherwise there are "more secure" bytes inside. Such internal flaw is a place to start cracking, I hope it is clearer right now. $\endgroup$ – Evil Apr 26 at 16:56
  • $\begingroup$ @ Evil your edited sentence can support my initial 'ANY 8 bits' but now there is a new question : from my prev comment NIST text i think it implies MSB-like value for hash digests .. Have a nice day both and Thanks a lot. $\endgroup$ – pogakl Apr 26 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.