aboutsummaryrefslogtreecommitdiffstats
path: root/java/sha3sum.java
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-05 01:19:54 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-05 01:19:54 +0100
commit40efdd34d40100dc045c8e8ed9b9030a3cc2343c (patch)
tree1c4e84b3aa26d7ef1ce388bcf93c190d502e2f9c /java/sha3sum.java
parentmove inte directories based on language (diff)
downloadsha3sum-40efdd34d40100dc045c8e8ed9b9030a3cc2343c.tar.gz
sha3sum-40efdd34d40100dc045c8e8ed9b9030a3cc2343c.tar.bz2
sha3sum-40efdd34d40100dc045c8e8ed9b9030a3cc2343c.tar.xz
different commands for different output sizes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--java/sha3sum.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/java/sha3sum.java b/java/sha3sum.java
index 6a122ff..ec00958 100644
--- a/java/sha3sum.java
+++ b/java/sha3sum.java
@@ -22,7 +22,7 @@ import java.util.*;
/**
- * SHA-3/Keccak chechsum calculator
+ * SHA-3/Keccak checksum calculator
*
* @author Mattias Andrée <a href="mailto:maandree@member.fsf.org">maandree@member.fsf.org</a>
*/
@@ -31,12 +31,24 @@ public class sha3sum
/**
* This is the main entry point of the program
*
+ * @param args Command line arguments
+ * @throws IOException On I/O error (such as broken pipes)
+ */
+ public static void main(String[] args) throws IOException
+ {
+ run("sha3sum", args);
+ }
+
+
+ /**
+ * Run the program
+ *
+ * @param cmd The command
* @param argv Command line arguments
* @throws IOException On I/O error (such as broken pipes)
*/
- public static void main(String[] argv) throws IOException
+ public static void run(String cmd, String[] argv) throws IOException
{
- String cmd, _cmd = cmd = ""; //FIXME /proc/self/cmdline split ^@ [0]
if (cmd.indexOf('/') >= 0)
cmd = cmd.substring(cmd.lastIndexOf('/') + 1);
if (cmd.endsWith(".jar"))
@@ -138,7 +150,7 @@ public class sha3sum
i = Integer.parseInt(linger[1]);
else
{
- System.err.println(_cmd + ": unrecognised option: " + linger[0]);
+ System.err.println(cmd + ": unrecognised option: " + linger[0]);
System.exit(1);
}
}
@@ -183,7 +195,7 @@ public class sha3sum
files[fptr++] = null;
if (i < 1)
{
- System.err.println(_cmd + ": sorry, I will only do at least one iteration!\n");
+ System.err.println(cmd + ": sorry, I will only do at least one iteration!\n");
System.exit(3);
}
@@ -237,7 +249,7 @@ public class sha3sum
}
}
catch (final IOException err)
- { System.err.println(_cmd + ": Cannot read file: " + filename + ": " + err);
+ { System.err.println(cmd + ": Cannot read file: " + filename + ": " + err);
fail = true;
}
finally
@@ -253,5 +265,6 @@ public class sha3sum
if (fail)
System.exit(5);
}
+
}