diff options
Diffstat (limited to 'gnu/java/security/hash/Sha160.java')
-rw-r--r-- | gnu/java/security/hash/Sha160.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gnu/java/security/hash/Sha160.java b/gnu/java/security/hash/Sha160.java index 88bf0e405..981a36db1 100644 --- a/gnu/java/security/hash/Sha160.java +++ b/gnu/java/security/hash/Sha160.java @@ -1,5 +1,5 @@ /* Sha160.java -- - Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2006, 2015 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -102,7 +102,7 @@ public class Sha160 this.h3 = md.h3; this.h4 = md.h4; this.count = md.count; - this.buffer = (byte[]) md.buffer.clone(); + this.buffer = md.buffer.clone(); } public static final int[] G(int hh0, int hh1, int hh2, int hh3, int hh4, @@ -111,11 +111,13 @@ public class Sha160 return sha(hh0, hh1, hh2, hh3, hh4, in, offset); } + @Override public Object clone() { return new Sha160(this); } + @Override protected void transform(byte[] in, int offset) { int[] result = sha(h0, h1, h2, h3, h4, in, offset); @@ -126,6 +128,7 @@ public class Sha160 h4 = result[4]; } + @Override protected byte[] padBuffer() { int n = (int)(count % BLOCK_SIZE); @@ -146,6 +149,7 @@ public class Sha160 return result; } + @Override protected byte[] getResult() { return new byte[] { @@ -156,6 +160,7 @@ public class Sha160 (byte)(h4 >>> 24), (byte)(h4 >>> 16), (byte)(h4 >>> 8), (byte) h4 }; } + @Override protected void resetContext() { // magic SHA-1/RIPEMD160 initialisation constants @@ -166,6 +171,7 @@ public class Sha160 h4 = 0xC3D2E1F0; } + @Override public boolean selfTest() { if (valid == null) |