Property
Languagekotlin
Severitylow
CWECWE-704: Incorrect Type Conversion or Cast
OWASPA03:2017 - Sensitive Data Exposure
Confidence LevelLow
Impact LevelLow
Likelihood LevelLow

Description#

Using Integer.toHexString() to convert hash or byte data to a hex string can strip leading zeroes from each byte, resulting in inconsistent or incorrect representations. This can cause different byte values to appear the same in the output.

Impact#

Incorrect hex conversion increases the risk of hash collisions, meaning distinct data may be represented by the same hash value. This weakens data integrity checks, potentially allowing attackers to bypass authentication, tamper with data, or cause other security failures that rely on unique hash values.