Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SHA-1 and Unicode

Is behavior of SHA-1 algorithm defined for Unicode strings? I do realize that SHA-1 itself does not care about the content of the string, however,
it seems to me that in order to pass standard tests for SHA-1, the input string should be encoded with UTF-8.

like image 446
Andrew Avatar asked Nov 23 '25 12:11

Andrew


1 Answers

SHA-1 is based on bytes; it doesn't care about the structure of the data. If you give it a bunch of bytes that consists of Unicode strings, you'll get a result. Keep in mind that the block size is 512 bits, so smaller amounts of data may cause security issues.

like image 180
WhirlWind Avatar answered Nov 27 '25 05:11

WhirlWind



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!