Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hash value lengths

Tags:

php

encryption

When referring to the length of a hash value such as sha1 or md5 in PHP, is it correct to interpret that as the size of the hash in memory rather than the number of characters present in the literal?

like image 238
Morgan Laco Avatar asked Jan 24 '26 15:01

Morgan Laco


1 Answers

Yes, it does. However, that size is tightly related to the amount of characters in the string -- if you get a raw string, you'll get 1 character per 8 bits; if you get hex digits (the default), you're getting 1 character per 4 bits.

like image 59
aaaaaa123456789 Avatar answered Jan 26 '26 05:01

aaaaaa123456789



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!