dromara / hutool

🍬A set of tools that keep Java sweet.
https://hutool.cn
Other
29.24k stars 7.53k forks source link

A possible parameter check to `md5HexTo16` #3763

Closed iscas-zac closed 1 month ago

iscas-zac commented 1 month ago

The md5HexTo16 https://github.com/dromara/hutool/blob/467d67e83ae5fc40364cda9e36e30a7283be2449/hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java#L198-L200 is public, and its substring index is not checked. Should we write a check in it?

looly commented 1 month ago

Bad md5Hex will cause the exception, No need to check.

iscas-zac commented 1 month ago

Should we add a throws IndexOutOfBoundException in its signature?

looly commented 1 month ago

IndexOutOfBoundException is runtimeException and no need to add signature.

and this method also throw NullPointException