Converting numbers, especially ones of a specific size, to hex has long been problematic. The built in functions don’t do a very good job with it and often drop leading zeros even when the integers size is known.
Dim s1 As String
s1 = Hex(13) // here 13 is an "Integer" literal
// and should be treated as a 32 bit integer in a 32 bit build
// or a 64 bit integer in a 64 bit build
Dim i8 As Int8 = 13
Dim s2 As String
s2 = i8.ToHex
… Read the rest