Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 d2504bc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/java/org/jenkinsci/remoting/util/KeyUtils.java
Expand Up @@ -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) {
Expand Down

0 comments on commit d2504bc

Please sign in to comment.