aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--java/sha3_224sum.java42
-rw-r--r--java/sha3_256sum.java42
-rw-r--r--java/sha3_384sum.java42
-rw-r--r--java/sha3_512sum.java42
-rw-r--r--java/sha3sum.java25
5 files changed, 187 insertions, 6 deletions
diff --git a/java/sha3_224sum.java b/java/sha3_224sum.java
new file mode 100644
index 0000000..fbed9a5
--- /dev/null
+++ b/java/sha3_224sum.java
@@ -0,0 +1,42 @@
+/**
+ * sha3sum – SHA-3 (Keccak) checksum calculator
+ *
+ * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ * SHA-3/Keccak checksum calculator with 224 bit output
+ *
+ * @author Mattias Andrée <a href="mailto:maandree@member.fsf.org">maandree@member.fsf.org</a>
+ */
+public class sha3_224sum
+{
+ /**
+ * 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
+ {
+ sha3sum.run("sha3-224sum", args);
+ }
+}
+
diff --git a/java/sha3_256sum.java b/java/sha3_256sum.java
new file mode 100644
index 0000000..4f06f1d
--- /dev/null
+++ b/java/sha3_256sum.java
@@ -0,0 +1,42 @@
+/**
+ * sha3sum – SHA-3 (Keccak) checksum calculator
+ *
+ * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ * SHA-3/Keccak checksum calculator with 256 bit output
+ *
+ * @author Mattias Andrée <a href="mailto:maandree@member.fsf.org">maandree@member.fsf.org</a>
+ */
+public class sha3_256sum
+{
+ /**
+ * 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
+ {
+ sha3sum.run("sha3-256sum", args);
+ }
+}
+
diff --git a/java/sha3_384sum.java b/java/sha3_384sum.java
new file mode 100644
index 0000000..8ca1552
--- /dev/null
+++ b/java/sha3_384sum.java
@@ -0,0 +1,42 @@
+/**
+ * sha3sum – SHA-3 (Keccak) checksum calculator
+ *
+ * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ * SHA-3/Keccak checksum calculator with 384 bit output
+ *
+ * @author Mattias Andrée <a href="mailto:maandree@member.fsf.org">maandree@member.fsf.org</a>
+ */
+public class sha3_384sum
+{
+ /**
+ * 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
+ {
+ sha3sum.run("sha3-384sum", args);
+ }
+}
+
diff --git a/java/sha3_512sum.java b/java/sha3_512sum.java
new file mode 100644
index 0000000..59e294a
--- /dev/null
+++ b/java/sha3_512sum.java
@@ -0,0 +1,42 @@
+/**
+ * sha3sum – SHA-3 (Keccak) checksum calculator
+ *
+ * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import java.io.*;
+import java.util.*;
+
+
+/**
+ * SHA-3/Keccak checksum calculator with 512 bit output
+ *
+ * @author Mattias Andrée <a href="mailto:maandree@member.fsf.org">maandree@member.fsf.org</a>
+ */
+public class sha3_512sum
+{
+ /**
+ * 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
+ {
+ sha3sum.run("sha3-512sum", args);
+ }
+}
+
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);
}
+
}