Skip to content

Commit 205878e

Browse files
author
gefeili
committed
Use Pack in FingerprintUtil
1 parent 4d567d6 commit 205878e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pg/src/main/java/org/bouncycastle/bcpg/FingerprintUtil.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.bouncycastle.bcpg;
22

3+
import org.bouncycastle.util.Pack;
4+
35
public class FingerprintUtil
46
{
57

@@ -51,14 +53,7 @@ public static long longFromLeftMostBytes(byte[] bytes)
5153
{
5254
throw new IllegalArgumentException("Byte array MUST contain at least 8 bytes");
5355
}
54-
return ((bytes[0] & 0xffL) << 56) |
55-
((bytes[1] & 0xffL) << 48) |
56-
((bytes[2] & 0xffL) << 40) |
57-
((bytes[3] & 0xffL) << 32) |
58-
((bytes[4] & 0xffL) << 24) |
59-
((bytes[5] & 0xffL) << 16) |
60-
((bytes[6] & 0xffL) << 8) |
61-
((bytes[7] & 0xffL));
56+
return Pack.bigEndianToLong(bytes, 0);
6257
}
6358

6459
/**

0 commit comments

Comments
 (0)