mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
Sha256Hash: direct use of ByteBuffer
in hashCode()
A hash code is just an arbitrary number. It doesn't care about signedness and endianess.
This commit is contained in:
parent
d478eb2a55
commit
c10cf7ccbe
@ -245,8 +245,8 @@ public class Sha256Hash implements Comparable<Sha256Hash> {
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// Use the last 4 bytes, not the first 4 which are often zeros in Bitcoin.
|
||||
return (int) ByteUtils.readUint32BE(bytes, LENGTH - (4 + 1));
|
||||
// use the last 4 bytes, not the first 4 which are often zeros in Bitcoin
|
||||
return ByteBuffer.wrap(bytes).getInt(LENGTH - Integer.BYTES);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user