Skip to content
Permalink
Browse files
[JENKINS-36871] Slightly faster code path to get hex conversion
- Avoids intermediate String representation. Could probably get faster still with BigInteger and zero-left-pad but it becomes harder to understand
  • Loading branch information
stephenc committed Aug 2, 2016
1 parent 90425ad commit d2504bc8f461e58027b57fa2cde12dfcd7297049
Showing 1 changed file with 2 additions and 5 deletions.
@@ -108,11 +108,8 @@ public static String fingerprint(@CheckForNull Key key) {
if (i > 0) {
result.append(':');
}
int b = bytes[i] & 0xFF;
if (b < 16) {
result.append('0');
}
result.append(Integer.toHexString(b));
result.append(Character.forDigit((bytes[i] >> 4) & 0x0f, 16));
result.append(Character.forDigit(bytes[i] & 0x0f, 16));
}
return result.toString();
} catch (NoSuchAlgorithmException e) {

0 comments on commit d2504bc

Please sign in to comment.