summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/crypto
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:36:47 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:36:47 -0600
commit2e55e5fd051278a949d698f84580bef12c9324d8 (patch)
treef3a2f33b3af02d8f72dc03034841835a60d01266 /tunnel/src/main/java/com/wireguard/crypto
parent40ebf8006e46f8857340648d7cea234ed699aed7 (diff)
global: format code
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/crypto')
-rw-r--r--tunnel/src/main/java/com/wireguard/crypto/Key.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/tunnel/src/main/java/com/wireguard/crypto/Key.java b/tunnel/src/main/java/com/wireguard/crypto/Key.java
index fe03fa2d..c11688d5 100644
--- a/tunnel/src/main/java/com/wireguard/crypto/Key.java
+++ b/tunnel/src/main/java/com/wireguard/crypto/Key.java
@@ -204,6 +204,16 @@ public final class Key {
return new Key(publicKey);
}
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this)
+ return true;
+ if (obj == null || obj.getClass() != getClass())
+ return false;
+ final Key other = (Key) obj;
+ return MessageDigest.isEqual(key, other.key);
+ }
+
/**
* Returns the key as an array of bytes.
*
@@ -214,6 +224,14 @@ public final class Key {
return Arrays.copyOf(key, key.length);
}
+ @Override
+ public int hashCode() {
+ int ret = 0;
+ for (int i = 0; i < key.length / 4; ++i)
+ ret ^= (key[i * 4 + 0] >> 0) + (key[i * 4 + 1] >> 8) + (key[i * 4 + 2] >> 16) + (key[i * 4 + 3] >> 24);
+ return ret;
+ }
+
/**
* Encodes the key to base64.
*
@@ -250,24 +268,6 @@ public final class Key {
return new String(output);
}
- @Override
- public int hashCode() {
- int ret = 0;
- for (int i = 0; i < key.length / 4; ++i)
- ret ^= (key[i * 4 + 0] >> 0) + (key[i * 4 + 1] >> 8) + (key[i * 4 + 2] >> 16) + (key[i * 4 + 3] >> 24);
- return ret;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (obj == this)
- return true;
- if (obj == null || obj.getClass() != getClass())
- return false;
- final Key other = (Key) obj;
- return MessageDigest.isEqual(key, other.key);
- }
-
/**
* The supported formats for encoding a WireGuard key.
*/