diff options
author | Kenny Root <kenny@the-b.org> | 2016-03-11 19:37:23 -0800 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2016-03-11 19:37:23 -0800 |
commit | d3c024afe9db3f44d95b2341dae3c246207f900b (patch) | |
tree | b2ae24bfab53cbc3e3a839e2a20adf780e6be87d | |
parent | dfb607ffeb77dfea843c5db93d28d035c2188ef4 (diff) | |
parent | 6f46015a01c6901a6e8e19cc8847ffd1c3785e33 (diff) | |
download | sshlib-d3c024afe9db3f44d95b2341dae3c246207f900b.tar.gz sshlib-d3c024afe9db3f44d95b2341dae3c246207f900b.tar.bz2 sshlib-d3c024afe9db3f44d95b2341dae3c246207f900b.zip |
Merge pull request #18 from kruton/extended-hostkey
ed25519: implement equality and hashCode
-rw-r--r-- | sshlib/src/main/java/com/trilead/ssh2/crypto/key/Ed25519Key.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sshlib/src/main/java/com/trilead/ssh2/crypto/key/Ed25519Key.java b/sshlib/src/main/java/com/trilead/ssh2/crypto/key/Ed25519Key.java index 5c9e549..2c49350 100644 --- a/sshlib/src/main/java/com/trilead/ssh2/crypto/key/Ed25519Key.java +++ b/sshlib/src/main/java/com/trilead/ssh2/crypto/key/Ed25519Key.java @@ -18,6 +18,7 @@ package com.trilead.ssh2.crypto.key; import java.security.Key; +import java.util.Arrays; /** * Java representation of a native Ed25519 key. @@ -42,4 +43,19 @@ public class Ed25519Key implements Key { public byte[] getEncoded() { return keyBytes; } + + @Override + public int hashCode() { + return Arrays.hashCode(keyBytes); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Ed25519Key)) { + return false; + } + + Ed25519Key otherKey = (Ed25519Key) other; + return Arrays.equals(keyBytes, otherKey.keyBytes); + } } |