diff --git a/BLAKE224 Visualization.pptx b/BLAKE224 Visualization.pptx
new file mode 100644
index 0000000..ed65173
Binary files /dev/null and b/BLAKE224 Visualization.pptx differ
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3e30eb5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+#Jcryptool visualization plug-in for SHA3 candidate BLAKE224
+
+The plug-ins won't be integrated into the Jcryptool software and released until they are authorized by Jcryptool Project leaders. For more details, please check the detail in README.md of master branch.
+
+##Before adding the visualization plug-in to Jcryptool, pleas also -follow the instructions in the README.MD of the master branch to construct general developing envrioment. If you have done that, please follow the instructions below.
+
+1. SHA-3 candidates list is on the official website of NIST(National Institute of Standards and Technology) below. http://csrc.nist.gov/groups/ST/hash/sha-3/Round1/submissions_rnd1.html. The submitted materials of the candidates can all be found on this website.
+
+2. To add visualization plug-ins, please firstly add the commands below into the org.jcryptool.visual.feature/feature.xml.
+
+ \
+
+3. Download the org.jcryptool.visual.sha3candidates folder. Add the project to eclipse by selecting the folder through File > Open Projects from File System > Directory... and click 'Finish'.
+
+4. If the plug-in in the folder doesn't work, please try compressing the zip file in the same name and replace all the contents of the original folder.
+
+5. Launch JCryptool in eclipse, click the "Visual" in the menu, and click in "SHA3 Candidates".
+
diff --git a/README.md.txt b/README.md.txt
deleted file mode 100644
index 0bb9011..0000000
--- a/README.md.txt
+++ /dev/null
@@ -1 +0,0 @@
-readme file
diff --git a/org.jcryptool.visual.sha3candidates.zip b/org.jcryptool.visual.sha3candidates.zip
new file mode 100644
index 0000000..39255bb
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates.zip differ
diff --git a/org.jcryptool.visual.sha3candidates/META-INF/MANIFEST.MF b/org.jcryptool.visual.sha3candidates/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..dde3915
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jcryptool.visual.sha3candidates;singleton:=true
+Bundle-Version: 0.9.9
+Bundle-Activator: org.jcryptool.visual.sha3candidates.HashingPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jcryptool.core.operations;bundle-version="0.9.9",
+ org.eclipse.help,
+ org.bouncycastle
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Import-Package: org.jcryptool.core.logging.utils
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-ClassPath: .
diff --git a/org.jcryptool.visual.sha3candidates/OSGI-INF/l10n/bundle.properties b/org.jcryptool.visual.sha3candidates/OSGI-INF/l10n/bundle.properties
new file mode 100755
index 0000000..a4bdcb2
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,6 @@
+#Properties file for org.jcryptool.visual.SHA3
+view.name.0 = SHA3 Candidates
+Visual.name.0 = SHA3 Candidates
+Bundle-Vendor.0 = jcryptool.org
+Bundle-Name.0 = SHA3 Candidates Plug-in
+restart.command.name = Restart
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/OSGI-INF/l10n/bundle_de.properties b/org.jcryptool.visual.sha3candidates/OSGI-INF/l10n/bundle_de.properties
new file mode 100755
index 0000000..ba6b8f5
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/OSGI-INF/l10n/bundle_de.properties
@@ -0,0 +1,6 @@
+#Properties file for org.jcryptool.visual.SHA3
+view.name.0 = SHA3
+Visual.name.0 = SHA3
+Bundle-Vendor.0 = jcryptool.org
+Bundle-Name.0 = SHA3 Plug-in
+restart.command.name = Neustart
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/eclipse/wb/swt/SWTResourceManager.class b/org.jcryptool.visual.sha3candidates/bin/org/eclipse/wb/swt/SWTResourceManager.class
new file mode 100755
index 0000000..e41ccbd
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/eclipse/wb/swt/SWTResourceManager.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/HashingPlugin.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/HashingPlugin.class
new file mode 100755
index 0000000..0726077
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/HashingPlugin.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAction.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAction.class
new file mode 100755
index 0000000..46af8c8
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAction.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAlgorithm.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAlgorithm.class
new file mode 100755
index 0000000..9a45dcc
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAlgorithm.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEHashState.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEHashState.class
new file mode 100755
index 0000000..c2a14ed
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEHashState.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_Action.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_Action.class
new file mode 100755
index 0000000..f2b4339
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_Action.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_Algorithm.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_Algorithm.class
new file mode 100755
index 0000000..846f025
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_Algorithm.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_HashState.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_HashState.class
new file mode 100755
index 0000000..5418bfc
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_HashState.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$1.class
new file mode 100755
index 0000000..bc4ab84
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$2.class
new file mode 100755
index 0000000..2e3edbe
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$3.class
new file mode 100755
index 0000000..0d3948c
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab.class
new file mode 100755
index 0000000..aaa0af5
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$1.class
new file mode 100755
index 0000000..a04fde0
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$2.class
new file mode 100755
index 0000000..c1074ab
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$3.class
new file mode 100755
index 0000000..941206e
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$4.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$4.class
new file mode 100755
index 0000000..cf6b5f3
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$4.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$5.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$5.class
new file mode 100755
index 0000000..92f96c9
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$5.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$6.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$6.class
new file mode 100755
index 0000000..7069a60
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$6.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$7.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$7.class
new file mode 100755
index 0000000..099fd13
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0$7.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0.class
new file mode 100755
index 0000000..73fd569
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$1.class
new file mode 100755
index 0000000..43fdf34
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$2.class
new file mode 100755
index 0000000..9c21ae6
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$3.class
new file mode 100755
index 0000000..7f8ee65
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$4.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$4.class
new file mode 100755
index 0000000..5126f85
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$4.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$5.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$5.class
new file mode 100755
index 0000000..7b451d6
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$5.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$6.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$6.class
new file mode 100755
index 0000000..610d75d
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$6.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$7.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$7.class
new file mode 100755
index 0000000..40243db
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00$7.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00.class
new file mode 100755
index 0000000..cd59d49
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$1.class
new file mode 100755
index 0000000..2859ad3
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$2.class
new file mode 100755
index 0000000..4455bfa
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$3.class
new file mode 100755
index 0000000..c623742
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$4.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$4.class
new file mode 100755
index 0000000..a4106a2
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1$4.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1.class
new file mode 100755
index 0000000..fcb9bd1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab2.class
new file mode 100755
index 0000000..b9702a1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3$1.class
new file mode 100755
index 0000000..fc65205
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3.class
new file mode 100755
index 0000000..6425325
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/fig1.PNG b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/fig1.PNG
new file mode 100755
index 0000000..63d3990
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/fig1.PNG differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/package-info.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/package-info.class
new file mode 100755
index 0000000..50231fb
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/package-info.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAction.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAction.class
new file mode 100755
index 0000000..c53ed47
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAction.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAlgorithm.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAlgorithm.class
new file mode 100755
index 0000000..2bbc0a0
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAlgorithm.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOHashState.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOHashState.class
new file mode 100755
index 0000000..f2dc8a2
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOHashState.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/package-info.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/package-info.class
new file mode 100755
index 0000000..e8c4834
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHO/package-info.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOAction.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOAction.class
new file mode 100755
index 0000000..4c7bfe4
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOAction.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOAlgorithm.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOAlgorithm.class
new file mode 100755
index 0000000..11c0f38
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOAlgorithm.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOHashState.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOHashState.class
new file mode 100755
index 0000000..7ec5b92
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/ECHOHashState.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/HashFunction.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/HashFunction.class
new file mode 100755
index 0000000..91b662f
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/HashFunction.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHAction.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHAction.class
new file mode 100755
index 0000000..53f2b76
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHAction.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHAlgorithm.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHAlgorithm.class
new file mode 100755
index 0000000..cb1779e
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHAlgorithm.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHHashState.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHHashState.class
new file mode 100755
index 0000000..0424dd3
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/JHHashState.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/package-info.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/package-info.class
new file mode 100755
index 0000000..2216dd5
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/algorithms/JH/package-info.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/handlers/RestartHandler.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/handlers/RestartHandler.class
new file mode 100755
index 0000000..af4e3c1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/handlers/RestartHandler.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$1.class
new file mode 100755
index 0000000..644db81
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$10.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$10.class
new file mode 100755
index 0000000..369402c
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$10.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$11.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$11.class
new file mode 100755
index 0000000..c53d3e9
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$11.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$12.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$12.class
new file mode 100755
index 0000000..e58c260
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$12.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$13.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$13.class
new file mode 100755
index 0000000..86495cc
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$13.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$14.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$14.class
new file mode 100755
index 0000000..a15fa9e
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$14.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$15.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$15.class
new file mode 100755
index 0000000..b62a541
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$15.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$16.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$16.class
new file mode 100755
index 0000000..069ab84
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$16.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$17.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$17.class
new file mode 100755
index 0000000..5c0a840
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$17.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$18.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$18.class
new file mode 100755
index 0000000..75890e5
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$18.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$19.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$19.class
new file mode 100755
index 0000000..a5145db
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$19.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$2.class
new file mode 100755
index 0000000..9a2a3fa
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$20.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$20.class
new file mode 100755
index 0000000..5ca753a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$20.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$21.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$21.class
new file mode 100755
index 0000000..5581d24
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$21.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$22.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$22.class
new file mode 100755
index 0000000..9a4afaf
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$22.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$3.class
new file mode 100755
index 0000000..50c34ab
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$4.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$4.class
new file mode 100755
index 0000000..5979c01
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$4.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$5.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$5.class
new file mode 100755
index 0000000..ab5ec0b
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$5.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$6.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$6.class
new file mode 100755
index 0000000..1fd73b1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$6.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$7.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$7.class
new file mode 100755
index 0000000..367d12a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$7.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$8.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$8.class
new file mode 100755
index 0000000..9e7daed
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$8.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$9.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$9.class
new file mode 100755
index 0000000..1782193
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView$9.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView.class
new file mode 100755
index 0000000..c2443b7
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$1.class
new file mode 100755
index 0000000..ff84330
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$10.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$10.class
new file mode 100755
index 0000000..a9f517f
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$10.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$11.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$11.class
new file mode 100755
index 0000000..2205047
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$11.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$12.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$12.class
new file mode 100755
index 0000000..d04d6c9
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$12.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$13.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$13.class
new file mode 100755
index 0000000..9381bc0
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$13.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$14.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$14.class
new file mode 100755
index 0000000..696ecea
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$14.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$15.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$15.class
new file mode 100755
index 0000000..0a592cf
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$15.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$16.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$16.class
new file mode 100755
index 0000000..dc5ba20
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$16.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$17.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$17.class
new file mode 100755
index 0000000..77ed125
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$17.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$18.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$18.class
new file mode 100755
index 0000000..339283d
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$18.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$19.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$19.class
new file mode 100755
index 0000000..7343ba4
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$19.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$2.class
new file mode 100755
index 0000000..6af3b52
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$20.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$20.class
new file mode 100755
index 0000000..1bc9fd0
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$20.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$21.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$21.class
new file mode 100755
index 0000000..2ef1777
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$21.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$22.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$22.class
new file mode 100755
index 0000000..554bafe
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$22.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$3.class
new file mode 100755
index 0000000..1b7024b
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$4.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$4.class
new file mode 100755
index 0000000..f058e01
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$4.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$5.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$5.class
new file mode 100755
index 0000000..696a947
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$5.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$6.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$6.class
new file mode 100755
index 0000000..c7cc773
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$6.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$7.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$7.class
new file mode 100755
index 0000000..0685419
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$7.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$8.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$8.class
new file mode 100755
index 0000000..aa0f0a9
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$8.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$9.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$9.class
new file mode 100755
index 0000000..5f87913
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin$9.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin.class
new file mode 100755
index 0000000..7b1df30
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView2_origin.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$1.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$1.class
new file mode 100755
index 0000000..aa7c3ef
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$1.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$10.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$10.class
new file mode 100755
index 0000000..5dcfc93
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$10.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$11.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$11.class
new file mode 100755
index 0000000..dbeaf83
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$11.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$12.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$12.class
new file mode 100755
index 0000000..237d32b
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$12.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$13.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$13.class
new file mode 100755
index 0000000..99f1eb3
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$13.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$14.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$14.class
new file mode 100755
index 0000000..a2a504b
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$14.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$15.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$15.class
new file mode 100755
index 0000000..f9c19b8
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$15.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$16.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$16.class
new file mode 100755
index 0000000..70f29c8
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$16.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$17.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$17.class
new file mode 100755
index 0000000..9828f77
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$17.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$18.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$18.class
new file mode 100755
index 0000000..ffc7c37
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$18.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$19.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$19.class
new file mode 100755
index 0000000..dfc76d8
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$19.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$2.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$2.class
new file mode 100755
index 0000000..bb3ab32
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$2.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$20.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$20.class
new file mode 100755
index 0000000..0bdfe07
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$20.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$21.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$21.class
new file mode 100755
index 0000000..8f525ee
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$21.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$22.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$22.class
new file mode 100755
index 0000000..c5abfa5
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$22.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$3.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$3.class
new file mode 100755
index 0000000..c3a6884
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$3.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$4.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$4.class
new file mode 100755
index 0000000..ca4dd39
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$4.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$5.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$5.class
new file mode 100755
index 0000000..e37b84c
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$5.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$6.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$6.class
new file mode 100755
index 0000000..2c78d5b
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$6.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$7.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$7.class
new file mode 100755
index 0000000..38e47b2
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$7.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$8.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$8.class
new file mode 100755
index 0000000..f72f6db
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$8.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$9.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$9.class
new file mode 100755
index 0000000..5d1d4d2
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin$9.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin.class
new file mode 100755
index 0000000..bb23b68
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/HashingView_Origin.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/Messages.class b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/Messages.class
new file mode 100755
index 0000000..6ea2e31
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/Messages.class differ
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/messages.properties b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/messages.properties
new file mode 100755
index 0000000..36f2894
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/messages.properties
@@ -0,0 +1,26 @@
+#Eclipse modern messages class
+#Sat Mar 07 13:03:56 CET 2015
+HashingView_0=SHA3 Candidates
+HashingView_1=\nA hash function maps a large input set to a smaller output set. The input is of variable length, however, the output, usually has a small fixed length. Here, it is possible to select a hash function and the representation type of the hash values. The hash values of both input texts are calculated and displayed at once. The difference between the two hash values displayed at the bottom is a measure of the sensitivity of a hash value concerning changes in the input.
+HashingView_10=Hash value 1
+HashingView_11=Difference of the two hash values
+HashingView_12=% of the bits are different (
+HashingView_13=\ of
+HashingView_14=). Longest unchanged bit sequence\: Offset
+HashingView_15=, length
+HashingView_16=example_en.txt
+HashingView_17=\ Longest changed bit sequence\: Offset
+HashingView_18=.\r\nNumber of longest bit sequences\: unchanged \=
+HashingView_2=Select a hash function
+HashingView_21=\ ; changed \=
+HashingView_3=Representation of the hash values
+HashingView_4=hexadecimal
+HashingView_5=decimal
+HashingView_6=binary
+HashingView_7=Input 1
+HashingView_8=Hash value 2
+HashingView_9=Input 2
+HashingView_btnChanged_text=Underline longest changed bit sequences
+HashingView_btnUnchanged_text=Underline longest unchanged bit sequences
+HashingView_mntmCopy_text=Copy
+HashingView_mntmSelectAll_text=Select All
diff --git a/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/messages_de.properties b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/messages_de.properties
new file mode 100755
index 0000000..5907121
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/bin/org/jcryptool/visual/sha3candidates/views/messages_de.properties
@@ -0,0 +1,26 @@
+#Eclipse modern messages class
+#Sat Mar 07 20:33:49 CET 2015
+HashingView_0=SHA3\u00E4t
+HashingView_1=\nEine Hashfunktion bildet eine gro\u00DFe Eingabemenge auf eine kleinere Zielmenge ab. Die Eingabe hat unterschiedliche L\u00E4ngen, dagegen hat die Ausgabe meist eine feste L\u00E4nge. Hier k\u00F6nnen Sie eine Hashfunktion und die Darstellung der Hashwerte ausw\u00E4hlen. Die Hashwerte beider Eingabetexte werden berechnet und sofort angezeigt. Der Unterschied der beiden Hashwerte ist ein Ma\u00DF f\u00FCr die Sensitivit\u00E4t der Hashwerte bzgl. \u00C4derungen in der Eingabe (er wird unten angezeigt).
+HashingView_10=Hashwert 1
+HashingView_11=Unterschied der beiden Hashwerte
+HashingView_12=% der Bits unterscheiden sich (
+HashingView_13=\ von
+HashingView_14=). L\u00E4ngste unver\u00E4nderte Bitfolge\: Offset
+HashingView_15=, L\u00E4nge
+HashingView_16=example_de.txt
+HashingView_17=\ L\u00E4ngste ver\u00E4nderte Bitfolge\: Offset
+HashingView_18=.\r\nAnzahl der l\u00E4ngsten Bitfolgen\: unver\u00E4ndert \=
+HashingView_2=Auswahl der Hashfunktion
+HashingView_21=\ ; ver\u00E4ndert \=
+HashingView_3=Darstellung der Hashwerte
+HashingView_4=hexadezimal
+HashingView_5=dezimal
+HashingView_6=bin\u00E4r
+HashingView_7=Eingabe 1
+HashingView_8=Hashwert 2
+HashingView_9=Eingabe 2
+HashingView_btnChanged_text=Unterstreiche l\u00E4ngste ver\u00E4nderte Bitfolgen
+HashingView_btnUnchanged_text=Unterstreiche l\u00E4ngste unver\u00E4nderte Bitfolgen
+HashingView_mntmCopy_text=Kopieren
+HashingView_mntmSelectAll_text=Alles markieren
diff --git a/org.jcryptool.visual.sha3candidates/build.properties b/org.jcryptool.visual.sha3candidates/build.properties
new file mode 100755
index 0000000..bf89749
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ OSGI-INF/,\
+ nl/,\
+ templates/
diff --git a/org.jcryptool.visual.sha3candidates/icons/view.gif b/org.jcryptool.visual.sha3candidates/icons/view.gif
new file mode 100755
index 0000000..9b9f79a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/icons/view.gif differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/contexts.xml b/org.jcryptool.visual.sha3candidates/nl/de/contexts.xml
new file mode 100755
index 0000000..87f43c5
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/contexts.xml
@@ -0,0 +1,9 @@
+
+
+
+ SHA3 ist eine Hash - Funktion, die momentan noch entwickelt wird. Hier stehen Ihnen drei verschiedene Kandidaten der zweiten Runde zur Verfügung.
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/ECHOTutorial.html b/org.jcryptool.visual.sha3candidates/nl/de/help/content/ECHOTutorial.html
new file mode 100755
index 0000000..ddb889f
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/help/content/ECHOTutorial.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Der Hashalgorithmus ECHO nimmt eine Nachricht und einen Salt als Eingabe. Der Salt ist 128 Bit lang. Wird dieser nicht angegeben
+ oder benötigt, dann ist der Defaultwert 0. Die Ausgabe kann jede Bitlänge zwischen 128 und 512 sein,
+ wobei vom NIST nur 4 Bitlängen gefordert sind. Grundsätzlich baut ECHO auf den bekannten Verschlüsselungsalgorithmus
+ AES auf. Je nachdem welche wie lang der Hashwert am Schluss sein soll, wird auf 2 unterschiedliche Kompressionsmethoden
+ zurückgegriffen.
+
+ Zuerst werden die 12 Words mit den letzten 4 Chaining-Words verknüpft, danach folgen die an AES angelehnten Runden.
+ Zum Schluss wird die Ausgabe per XOR mit der Eingabe verknüpft und die erste Spalte als Chainingvariable
+ weiter verwendet. Bei einem Hashwert von 128 bis 256 ist die Chainingvariable 512 Bit lang.
+ Als Hashwert werden die ersten Bits in der Länge des Hashwertes genommen.
+
+ JH ist ein effizienter Algorithmus, der auf einfachen Rundenfunktionen aufbaut.
+ Es wird ein Komprimierungsfunktion verwendet die ihre Daten aus einer großen Permutation (bijektive Funktion) erhält.
+ Im Allgemeinen ist JH an das verallgemeinerte AES-Design SPN (Subsitution-Permutation-Network) und MDS (Maximum Distance Separable) angelehnt.
+ Im Gegensatz zum AES-Design verwendet JH ein 8 dimensionales Array. Dieses Design der Permutation verbindet die besten Eigenschaften von AES (SPN + MDS) und Serpent (SPN + bitslice).
+
+
+ Skein ist ein einfach strukturiertes und schnelles Hashverfahren das auf die
+ Blockchiffre Threefish aufbaut. Zusätzlich enthält es einen UBI(Unique Block Interaction) mit Tweak.
+
+ Threefish ist eine n-bit Blockchiffre mit einem 128-bit Tweak, daher ergibt sich für n: 256, 512, 1024 bit.
+
+ Skein verwendet einfache Operationen(add, rotate, xor) und arbeitet mit
+ 64-bit Worten. Die Blockchiffre beinhaltet Zusatzinformationen (Tweak), welche
+ ein Byte Zähler(der bereits verarbeiteten) und ein Typ Feld beinhalten.
+
- Threefish beinhaltet:
+ - MIX - Operation
+ - Rundenstruktur (72–80 Runden, alle 4 Runden wird ein Rundenschlüssel addiert)
+ - der Key Schedule (aus n-bit Schlüssel und 128-bit Tweak werden 19–21 n-bit Rundenschlüssel generiert)
+
+
+
+
+ - Rechnet auf 64-bit Worten
+ - amortisiert 1 Taktzyklus auf Referenzplattform
+ - Rotation um einen von den Daten unabhängigen Wert (1 bis 63)
+
+
+
+ - 4 Runden von Threefish-512
+ 
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure1.png b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure1.png
new file mode 100755
index 0000000..0f57e3a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure1.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure2.png b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure2.png
new file mode 100755
index 0000000..518fc33
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure2.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure3.png b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure3.png
new file mode 100755
index 0000000..cdaaed5
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure3.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure4.png b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure4.png
new file mode 100755
index 0000000..fe84ca1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Skeinfigure4.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/Tutorial.html b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Tutorial.html
new file mode 100755
index 0000000..3daf857
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/help/content/Tutorial.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+ SHA-3
+
+
+
+ SHA-3
+ Der Begriff secure hash algorithm (engl. für sicherer Hash-Algorithmus), kurz SHA, bezeichnet eine Gruppe standardisierter kryptologischer Hashfunktionen (siehe Wikipedia). Die Hash-Funktion Keccak wurde vom NIST als SHA-3 zum Nachfolger der SHA-1/2-Familie ernannt.
+
+ Beim Auswahlverfahren haben es mehrere Kandidaten in die zweite Runde geschafft. In JCrypTool sind folgende SHA-3-Kandidaten implementiert:
+
+ Auf den Unterseiten finden Sie nähere Informationen zu den einzelnen Kandidaten.
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/UI/TutorialUI.html b/org.jcryptool.visual.sha3candidates/nl/de/help/content/UI/TutorialUI.html
new file mode 100755
index 0000000..56ee8d0
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/help/content/UI/TutorialUI.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+ SHA-3-Kandidaten
+
+
+
+ SHA-3-Kandidaten
+
+ Hashwert erzeugen
+
+ Der Hashwert wird immer vom aktuellen Editor berechnet. Starten Sie den SHA3 Wizard, welcher unter Algorithmen -> Hash-> SHA-3-Kandidaten
+ zu finden ist. Nun können Sie den gewünschten Algorithmus auswählen.
+
+ Hierbei ist zu beachten, dass jeder Algorithmus unterschiedliche Hash-Bitlängen unterstützt, daher sollte ein passender Algorithmus gewählt werden,
+ falls eine bestimmte Bitlänge benötig wird.
+ Im Anschluss müssen Sie eine Bitlänge wählen (die angezeigten Werte sind auch die unterstützten Bitlängen). Nun wählen Sie
+ unter Optionen "Hash erzeugen".
+ Damit Ihnen das Arbeiten mit dem erzeugten Hashwert leichter fällt, kann die Ausgabeform des Hashwertes frei gewählt werden.
+
+ - Hexeditor: Gibt den Hashwert im Hexeditor aus.
+ - Texteditor: Gibt den Hashwert geblockt im Texteditor aus, was den Hash anschaulicher macht.
+ - Hashstream: gibt den Hashwert in einer Zeile ohne Abstand im Texteditor aus, wodurch das Verifizieren leichter fällt.
+
+
+ Durch klicken auf den "Finish" Button wird der Hash mit den ausgewählten Optionen erzeugt.
+
+ Hashwert verifizieren
+
+ Beim Verifizieren wird ebenfalls der Hashwert vom aktuellen Editor berechnet und anschließend mit einem anderen geprüft, ob es sich um
+ denselben handelt. Es werden jeweils beide Hashwerte ausgegeben und das Ergebnis dieser Überprüfung. Dazu müssen Sie ebenfalls den SHA3 - Wizard
+ öffnen und den Algorithmus sowie seine Bitlänge eingeben. Hierbei handelt es sich um den Algorithmus/Bitlänge des zu überprüfenden Hashwertes.
+ Unter Optionen wird nun "Hash verifizieren" gewählt, wodurch das darunter liegende Feld benutzbar wird. In diesem Feld kann man nun
+ den Hashwert eingeben. Mit dem Finish Button startet die Verifikation.
+
+
+
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/button.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/button.jpg
new file mode 100755
index 0000000..4a00364
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/button.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/difference.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/difference.jpg
new file mode 100755
index 0000000..c89aeba
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/difference.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/hashes.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/hashes.jpg
new file mode 100755
index 0000000..1490614
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/hashes.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/index.html b/org.jcryptool.visual.sha3candidates/nl/de/help/content/index.html
new file mode 100755
index 0000000..1af156e
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/help/content/index.html
@@ -0,0 +1,98 @@
+
+
+
+
+Hash-Sensitivität
+
+
+Hash-Sensitivität
+
+
+Diese Onlinehilfe erklärt die Funktionsweise des Plug-ins Hash-Sensitivität.
+
+
+
+Das Plug-in lässt sich über das Menü Visualisierungen oder über den Krypto-Explorer im Tab Visualisierungen starten.
+
+
+
+Das Plug-in besteht aus einem Beschreibungsfeld und vier Grundbereichen: Hashfunktion, Eingabetext 1, Eingabetext 2 und
+Unterschied.
+
+In dem Beschreibungsfeld wird die Erklärungen über den Algorithmus angezeigt.
+
+In der Hashfunktions-Bereich kann man eine Hashfunktion und dessen Darstellung auswählen.
+
+
+
+Folgende Hashfunktionen sind verfügbar:
+
+ - MD2 (128 bits)
+ - MD4 (128 bits)
+ - MD5 (128 bits)
+ - SHA-1 (160 bits)
+ - SHA-2 (256 bits)
+ - SHA-2 (512 bits)
+ - SHA-3 (224 bits)
+ - SHA-3 (256 bits)
+ - SHA-3 (384 bits)
+ - SHA-3 (512 bits)
+ - SKEIN-256 (256 bits)
+ - SKEIN-512 (512 bits)
+ - SKEIN-1024 (1024 bits)
+ - SM3 (256 bits)
+ - RIPEMD-160 (160 bits)
+ - TIGER (192 bits)
+ - GOST3411 (256 bits)
+ - WHIRLPOOL (512 bits)
+
+
+
+Die Hashfunktion kann als hexadezimal, dezimal oder binär dargestellt werden.
+
+
+
+
+Man kann in dem Eingabetext 1 Feld einen beliebigen Text eingeben.
+
+
+
+
+Das Gleiche gilt für für den Eingabetext 2.
+
+
+
+
+Die Hashwerte für den Eingabetext 1 und 2 werden berechnet und unten in der ausgewählen Darstellung angezeigt.
+
+
+
+
+
+Basierend auf der Eingabe des Eingabetext 1 und 2 wird der Unterschied der Bits im Hashwert unten angezeigt und in der Farbe rot hervorgehoben.
+
+
+
+
+Es werden außerdem einige Statistiken angezeigt.
+
+Man kann zu jeder Zeit die Hashfunktion und die Darstellung ändern. Der Hashwert des Eingabetext 1 und 2 wird dynamisch berechnet und der Unterschied der Bits des Hashwertes im Berech Unterschied angezeigt.
+
+Wenn man auf den Button Unterstreiche längste unveränderte Bitfolgen klickt, werden die längste unveränderte Bitfolgen unterschrichen. Das gleiche gilt für den Button Unterstreiche längste veränderte Bitfolgen.
+
+
+
+
+
+Wenn man auf das Restart-Icon
in der Menüleiste klickt, wird der Standardtext in den Einabetext 1 und 2 geladen.
+
+
+Quellen
+
+-   Dogan, Ferit: Design and Implementation of Plug-ins for JCrypTool - Visualization of the Merkle-Hellman Algorithm and of Hash Sensitivity Diplom-Thesis 2015 - TU-Darmstadt
+-   Wikipedia-Link Kryptologische Hashfunktion
+-   The Legion of the Bouncy Castle
+
+
+
+
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/input.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/input.jpg
new file mode 100755
index 0000000..5bfa06d
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/input.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/output.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/output.jpg
new file mode 100755
index 0000000..bfebdda
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/output.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/representation.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/representation.jpg
new file mode 100755
index 0000000..dcbb90b
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/representation.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/restart.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/restart.jpg
new file mode 100755
index 0000000..5a4dea7
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/restart.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/content/selection.jpg b/org.jcryptool.visual.sha3candidates/nl/de/help/content/selection.jpg
new file mode 100755
index 0000000..edc2cd2
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/de/help/content/selection.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/contexts.xml b/org.jcryptool.visual.sha3candidates/nl/de/help/contexts.xml
new file mode 100755
index 0000000..9b95cd5
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/help/contexts.xml
@@ -0,0 +1,7 @@
+
+
+
+ Hash-Sensitivität
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/help/toc.xml b/org.jcryptool.visual.sha3candidates/nl/de/help/toc.xml
new file mode 100755
index 0000000..5903ae4
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/help/toc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/de/tocUI.xml b/org.jcryptool.visual.sha3candidates/nl/de/tocUI.xml
new file mode 100755
index 0000000..f337aef
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/de/tocUI.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/contexts.xml b/org.jcryptool.visual.sha3candidates/nl/en/contexts.xml
new file mode 100755
index 0000000..0af356e
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/contexts.xml
@@ -0,0 +1,9 @@
+
+
+
+ SHA3 is a hash function which is still development. Here are three implementations of the second round available for you.
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html b/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html
new file mode 100755
index 0000000..58fd40a
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+ SHA 3 - ECHO
+
+
+
+ SHA 3 - ECHO
+
+ The hash function ECHO takes a message and salt as input. The salt is 128 bits long and if for some reason it is
+ unneeded or left unspecified, then it takes the all-zero value by default.The output from ECHO can be of any length from
+ 128 to 512 bits, but NIST only claimed 4 different bitlengths. Basically ECHO is built on the known encryption algorithm AES.
+ ECHO uses 2 different compression methods, depending on the output length.
+
+
+ The following bitlength are supported:
+
+ - 224 Bit
+ - 256 Bit
+ - 384 Bit
+ - 512 Bit
+
+
+ How ECHO works:
+
+
+ At first the 12 input words are connected with the last 4 chaining words and then the AES rounds follow.
+ After that the output is linked to the input per XOR and the first column is used as chaining variable. If the hashlength is between
+ 128 and 256 the chainingvariable has a length of 512 byte.
+ The first bit of the last chaining variable are use as hashvalue.
+
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOfigure1.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOfigure1.png
new file mode 100755
index 0000000..210ddda
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOfigure1.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/HashValues.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/HashValues.jpg
new file mode 100755
index 0000000..5931265
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/HashValues.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHTutorial.html b/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHTutorial.html
new file mode 100755
index 0000000..3610db3
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHTutorial.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+ SHA 3 - JH
+
+
+
+ SHA 3 - JH
+
+
+ JH is a very efficient algorithm; the design is based on coherent round functions.
+ A compression function is used to reduce the input out of a big permutation (bijective function).
+ JH is applied on the general AES design SPN (Substitution-Permutation-Network) and MDS (Maximum Distance Separable).
+ JH uses a array with 8 dimensions. This design combines the characteristics of AES (SPN + MDS) and Serpent (SPN + bitslice).
+
+ The following bitlength are supported:
+
+ - 224 Bit
+ - 256 Bit
+ - 384 Bit
+ - 512 Bit
+
+
+ JH compression function:
+
+
+ bijective function E (EDP):
+
+
+ Truncate:
+ Last the final hash is truncated from 1024 Bit to 224, 256, 384 or 512 Bit.
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHfigure1.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHfigure1.png
new file mode 100755
index 0000000..bfb2261
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHfigure1.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHfigure2.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHfigure2.png
new file mode 100755
index 0000000..75dfe7a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/JHfigure2.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/SkeinTutorial.html b/org.jcryptool.visual.sha3candidates/nl/en/help/content/SkeinTutorial.html
new file mode 100755
index 0000000..4f2c96d
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/content/SkeinTutorial.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+ SHA 3 - Skein
+
+
+
+ SHA 3 - Skein
+
+
+ Skein is a fast hash algorithm with a simple design built on Threefish.
+ Additionally Skein includes UBI (Unique Block Interaction) with Tweak.
+
+ Threefish is a n-bit block cipher with a Tweak of 128-bit. And so there are 3 possible hashbitlength: 256, 512 and 1024 bit.
+
+ Skein uses simple operations (add, rotate, xor). It also uses 64-bit words.
+ Additional information (Tweak) is also included in the block cipher. A counter for already used bytes and a field for the used type.
+
+
+ - The UBI mode for "Tweakable" block cipher
+ - Calculating a Sub - Hash
+
+ 
+
+ - Calculating an Output - Hash
+
+ 
+
+ - Threefish a block cipher with "Tweak"
+ - Threefish includes
+ - MIX - Operations
+ - Roundfunctions (72-80 rounds, after every forth round, a new round key will be added)
+ - The Key Schedule (out of the n-bit key and the 128-bit Tweak will be generated a 19-21 n-bit round key)
+
+
+
+
+
+ - Calculation the offset to 64-bit words
+ - Amortizes one clock cycle on the reference platform
+ - Rotating a data independent value (1 to 63)
+
+
+
+ - 4 rounds of Threefish-512
+
+

+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure1.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure1.png
new file mode 100755
index 0000000..0f57e3a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure1.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure2.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure2.png
new file mode 100755
index 0000000..518fc33
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure2.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure3.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure3.png
new file mode 100755
index 0000000..cdaaed5
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure3.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure4.png b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure4.png
new file mode 100755
index 0000000..fe84ca1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Skeinfigure4.png differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/Tutorial.html b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Tutorial.html
new file mode 100755
index 0000000..f8f76eb
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/content/Tutorial.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+ SHA-3
+
+
+
+ SHA-3
+
+ The Secure Hash Algorithm is a family of cryptographic hash functions published by the National Institute of Standards and Technology (NIST) as a U.S. Federal Information Processing Standard (FIPS) (siehe Wikipedia).
+ The NIST had chosen the hash function Keccak as SHA-3 and thus successor of the SHA-1/2 family.
+
+ A few candidates have achieved the second round of the selection process. JCrypTool implements the following candidates:
+
+
+
+ More information is available on the sub sites.
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/UI/TutorialUI.html b/org.jcryptool.visual.sha3candidates/nl/en/help/content/UI/TutorialUI.html
new file mode 100755
index 0000000..3b08c52
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/content/UI/TutorialUI.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+ Verify hash
+
+
+
+ SHA-3 Candidates
+
+ Generate hash
+
+ The hash is generated out of the current active editor. Start the SHA-3 wizard. It can be found in Algorithm -> Hash - > SHA3-Candidates
+ Chose a algorithm you want to use. I would like to remind you that all candidates could support different hash bitlength.
+ Then choose a compatibly hash bitlength. Last you have to click on the hash button.
+
For better understanding you could choose the output form of the hash value.
+
+ - Hexeditor: displays hashcode in a hex editor.
+ - Texteditor: displays hashcode blocked in a text editor, so the generated hashcode is well-arranged.
+ - Hashstream: displays hashcode in a row of characters in text editor, so the verification is easier to use.
+
+ By clicking on the "Finish" button the hash will be generated.
+ Verify hash
+
+ If you want to verify a text, a hashcode will be generated out of the editor.
+ This hashcode will be compared with the original hashcode.
+ The original and the new generated hashcode and also the conclusion of the compare.
+
+ For the verification you have also to use the SHA-3 wizard with the right algorithm and hash bitlength.
+ But now you have to choose the option "Hash verification". Now a new field will be available.
+ And in this field you have to insert the original hashcode.
+ By clicking on the Finish button the verification will be started.
+
+
+
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/button.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/button.jpg
new file mode 100755
index 0000000..6f9b6a2
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/button.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/difference.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/difference.jpg
new file mode 100755
index 0000000..a55802a
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/difference.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/hashes.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/hashes.jpg
new file mode 100755
index 0000000..63790a1
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/hashes.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/index.html b/org.jcryptool.visual.sha3candidates/nl/en/help/content/index.html
new file mode 100755
index 0000000..4e0ee88
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/content/index.html
@@ -0,0 +1,96 @@
+
+
+
+
+Hash Sensitivity
+
+
+Hash Sensitivity
+
+
+This online help describes the functionality of the plug-in Hash Sensitivity.
+
+The plug-in can be started via the menu Visuals or via the crypto explorer tab Visuals.
+
+
+
+The plug-in consists of a description field and four basic areas: Hash function, Input 1 text, Input 2 text and Difference.
+
+
+In the description field some statements about the algorithm are displayed dynamically.
+
+In the hash function area you can select a hash function and the representation you want.
+
+
+
+
+There are the following hash functions available:
+
+ - MD2 (128 bits)
+ - MD4 (128 bits)
+ - MD5 (128 bits)
+ - SHA-1 (160 bits)
+ - SHA-2 (256 bits)
+ - SHA-2 (512 bits)
+ - SHA-3 (224 bits)
+ - SHA-3 (256 bits)
+ - SHA-3 (384 bits)
+ - SHA-3 (512 bits)
+ - SKEIN-256 (256 bits)
+ - SKEIN-512 (512 bits)
+ - SKEIN-1024 (1024 bits)
+ - SM3 (256 bits)
+ - RIPEMD-160 (160 bits)
+ - TIGER (192 bits)
+ - GOST3411 (256 bits)
+ - WHIRLPOOL (512 bits)
+
+
+
+The hash function can be represented in hexadecimal, decimal or binary.
+
+
+
+
+In the input 1 text area you can enter any text.
+
+
+
+
+The same for the input 2 text area.
+
+
+
+
+The hash values of input 1 and input 2 text will be calculated and displayed below in the corresponding representation.
+
+
+
+
+
+Based on the entry of the input 1 and input 2 text the differences of the bits in the hash value will be displayed in the differences area.
+The different bits are highlighted in color red.
+
+
+
+
+There are also some statistics displayed.
+
+You can change at any time the hash function and the representation. The hash values of the input 1 and input 2 text will be calculated dynamically and the differences of the has values will be shown in the difference area.
+
+When you click the radio button Underline longest unchanged bit sequences the unchanged bit sequence will be underlined. The same is for the button Underline longest changed bit sequences.
+
+
+
+
+When you click the Restart icon
in the menu bar the default text will be loaded into the input 1 and input 2 text area.
+
+References
+
+-   Dogan, Ferit: Design and Implementation of Plug-ins for JCrypTool - Visualization of the Merkle-Hellman Algorithm and of Hash Sensitivity Diploma Thesis 2015 - TU-Darmstadt
+-   Wikipedia-Link Cryptographic hash function
+-   The Legion of the Bouncy Castle
+
+
+
+
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/input.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/input.jpg
new file mode 100755
index 0000000..725dbb6
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/input.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/output.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/output.jpg
new file mode 100755
index 0000000..9902968
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/output.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/representation.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/representation.jpg
new file mode 100755
index 0000000..2520d07
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/representation.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/restart.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/restart.jpg
new file mode 100755
index 0000000..5a4dea7
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/restart.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/content/selection.jpg b/org.jcryptool.visual.sha3candidates/nl/en/help/content/selection.jpg
new file mode 100755
index 0000000..1a2aae0
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/nl/en/help/content/selection.jpg differ
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/contexts.xml b/org.jcryptool.visual.sha3candidates/nl/en/help/contexts.xml
new file mode 100755
index 0000000..a4e0b75
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/contexts.xml
@@ -0,0 +1,7 @@
+
+
+
+ Hash Sensitivity
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/help/toc.xml b/org.jcryptool.visual.sha3candidates/nl/en/help/toc.xml
new file mode 100755
index 0000000..dfe4287
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/help/toc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/nl/en/tocUI.xml b/org.jcryptool.visual.sha3candidates/nl/en/tocUI.xml
new file mode 100755
index 0000000..cf40ba1
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/nl/en/tocUI.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/plugin.xml b/org.jcryptool.visual.sha3candidates/plugin.xml
new file mode 100755
index 0000000..21bc07d
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/plugin.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.jcryptool.visual.sha3candidates/pom.xml b/org.jcryptool.visual.sha3candidates/pom.xml
new file mode 100755
index 0000000..9e5e2ba
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/pom.xml
@@ -0,0 +1,13 @@
+
+
+
+ org.jcryptool
+ org.jcryptool.crypto.parent
+ 0.9.9
+
+ 4.0.0
+ org.jcryptool.visual.sha3candidates
+ eclipse-plugin
+
diff --git a/org.jcryptool.visual.sha3candidates/src/org/eclipse/wb/swt/SWTResourceManager.java b/org.jcryptool.visual.sha3candidates/src/org/eclipse/wb/swt/SWTResourceManager.java
new file mode 100755
index 0000000..d8a2858
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/eclipse/wb/swt/SWTResourceManager.java
@@ -0,0 +1,447 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Google, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Google, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wb.swt;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
+ *
+ * !!! IMPORTANT !!! Application code must explicitly invoke the dispose() method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ *
+ * This class may be freely distributed as part of any application or plugin.
+ *
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Color
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map m_colorMap = new HashMap();
+ /**
+ * Returns the system {@link Color} matching the specific ID.
+ *
+ * @param systemColorID
+ * the ID value for the color
+ * @return the system {@link Color} matching the specific ID
+ */
+ public static Color getColor(int systemColorID) {
+ Display display = Display.getCurrent();
+ return display.getSystemColor(systemColorID);
+ }
+ /**
+ * Returns a {@link Color} given its red, green and blue component values.
+ *
+ * @param r
+ * the red component of the color
+ * @param g
+ * the green component of the color
+ * @param b
+ * the blue component of the color
+ * @return the {@link Color} matching the given red, green and blue component values
+ */
+ public static Color getColor(int r, int g, int b) {
+ return getColor(new RGB(r, g, b));
+ }
+ /**
+ * Returns a {@link Color} given its RGB value.
+ *
+ * @param rgb
+ * the {@link RGB} value of the color
+ * @return the {@link Color} matching the RGB value
+ */
+ public static Color getColor(RGB rgb) {
+ Color color = m_colorMap.get(rgb);
+ if (color == null) {
+ Display display = Display.getCurrent();
+ color = new Color(display, rgb);
+ m_colorMap.put(rgb, color);
+ }
+ return color;
+ }
+ /**
+ * Dispose of all the cached {@link Color}'s.
+ */
+ public static void disposeColors() {
+ for (Color color : m_colorMap.values()) {
+ color.dispose();
+ }
+ m_colorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps image paths to images.
+ */
+ private static Map m_imageMap = new HashMap();
+ /**
+ * Returns an {@link Image} encoded by the specified {@link InputStream}.
+ *
+ * @param stream
+ * the {@link InputStream} encoding the image data
+ * @return the {@link Image} encoded by the specified input stream
+ */
+ protected static Image getImage(InputStream stream) throws IOException {
+ try {
+ Display display = Display.getCurrent();
+ ImageData data = new ImageData(stream);
+ if (data.transparentPixel > 0) {
+ return new Image(display, data, data.getTransparencyMask());
+ }
+ return new Image(display, data);
+ } finally {
+ stream.close();
+ }
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(String path) {
+ Image image = m_imageMap.get(path);
+ if (image == null) {
+ try {
+ image = getImage(new FileInputStream(path));
+ m_imageMap.put(path, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(path, image);
+ }
+ }
+ return image;
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path relative to the specified class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image
+ * @param path
+ * the path to the image file, if starts with '/'
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(Class> clazz, String path) {
+ String key = clazz.getName() + '|' + path;
+ Image image = m_imageMap.get(key);
+ if (image == null) {
+ try {
+ image = getImage(clazz.getResourceAsStream(path));
+ m_imageMap.put(key, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(key, image);
+ }
+ }
+ return image;
+ }
+ private static final int MISSING_IMAGE_SIZE = 10;
+ /**
+ * @return the small {@link Image} that can be used as placeholder for missing image.
+ */
+ private static Image getMissingImage() {
+ Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ //
+ GC gc = new GC(image);
+ gc.setBackground(getColor(SWT.COLOR_RED));
+ gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ gc.dispose();
+ //
+ return image;
+ }
+ /**
+ * Style constant for placing decorator image in top left corner of base image.
+ */
+ public static final int TOP_LEFT = 1;
+ /**
+ * Style constant for placing decorator image in top right corner of base image.
+ */
+ public static final int TOP_RIGHT = 2;
+ /**
+ * Style constant for placing decorator image in bottom left corner of base image.
+ */
+ public static final int BOTTOM_LEFT = 3;
+ /**
+ * Style constant for placing decorator image in bottom right corner of base image.
+ */
+ public static final int BOTTOM_RIGHT = 4;
+ /**
+ * Internal value.
+ */
+ protected static final int LAST_CORNER_KEY = 5;
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @return {@link Image} The resulting decorated image
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @param corner
+ * the corner to place decorator image
+ * @return the resulting decorated {@link Image}
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ Rectangle bib = baseImage.getBounds();
+ Rectangle dib = decorator.getBounds();
+ //
+ result = new Image(Display.getCurrent(), bib.width, bib.height);
+ //
+ GC gc = new GC(result);
+ gc.drawImage(baseImage, 0, 0);
+ if (corner == TOP_LEFT) {
+ gc.drawImage(decorator, 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ gc.drawImage(decorator, 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height);
+ }
+ gc.dispose();
+ //
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached {@link Image}'s.
+ */
+ public static void disposeImages() {
+ // dispose loaded images
+ {
+ for (Image image : m_imageMap.values()) {
+ image.dispose();
+ }
+ m_imageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Font
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps font names to fonts.
+ */
+ private static Map m_fontMap = new HashMap();
+ /**
+ * Maps fonts to their bold versions.
+ */
+ private static Map m_fontToBoldFontMap = new HashMap();
+ /**
+ * Returns a {@link Font} based on its name, height and style.
+ *
+ * @param name
+ * the name of the font
+ * @param height
+ * the height of the font
+ * @param style
+ * the style of the font
+ * @return {@link Font} The font matching the name, height and style
+ */
+ public static Font getFont(String name, int height, int style) {
+ return getFont(name, height, style, false, false);
+ }
+ /**
+ * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline
+ * flags are also supported.
+ *
+ * @param name
+ * the name of the font
+ * @param size
+ * the size of the font
+ * @param style
+ * the style of the font
+ * @param strikeout
+ * the strikeout flag (warning: Windows only)
+ * @param underline
+ * the underline flag (warning: Windows only)
+ * @return {@link Font} The font matching the name, height, style, strikeout and underline
+ */
+ public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
+ String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
+ Font font = m_fontMap.get(fontName);
+ if (font == null) {
+ FontData fontData = new FontData(name, size, style);
+ if (strikeout || underline) {
+ try {
+ Class> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
+ Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
+ if (logFont != null && logFontClass != null) {
+ if (strikeout) {
+ logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ if (underline) {
+ logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ }
+ } catch (Throwable e) {
+ System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ font = new Font(Display.getCurrent(), fontData);
+ m_fontMap.put(fontName, font);
+ }
+ return font;
+ }
+ /**
+ * Returns a bold version of the given {@link Font}.
+ *
+ * @param baseFont
+ * the {@link Font} for which a bold version is desired
+ * @return the bold version of the given {@link Font}
+ */
+ public static Font getBoldFont(Font baseFont) {
+ Font font = m_fontToBoldFontMap.get(baseFont);
+ if (font == null) {
+ FontData fontDatas[] = baseFont.getFontData();
+ FontData data = fontDatas[0];
+ font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
+ m_fontToBoldFontMap.put(baseFont, font);
+ }
+ return font;
+ }
+ /**
+ * Dispose all of the cached {@link Font}'s.
+ */
+ public static void disposeFonts() {
+ // clear fonts
+ for (Font font : m_fontMap.values()) {
+ font.dispose();
+ }
+ m_fontMap.clear();
+ // clear bold fonts
+ for (Font font : m_fontToBoldFontMap.values()) {
+ font.dispose();
+ }
+ m_fontToBoldFontMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Cursor
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps IDs to cursors.
+ */
+ private static Map m_idToCursorMap = new HashMap();
+ /**
+ * Returns the system cursor matching the specific ID.
+ *
+ * @param id
+ * int The ID value for the cursor
+ * @return Cursor The system cursor matching the specific ID
+ */
+ public static Cursor getCursor(int id) {
+ Integer key = Integer.valueOf(id);
+ Cursor cursor = m_idToCursorMap.get(key);
+ if (cursor == null) {
+ cursor = new Cursor(Display.getDefault(), id);
+ m_idToCursorMap.put(key, cursor);
+ }
+ return cursor;
+ }
+ /**
+ * Dispose all of the cached cursors.
+ */
+ public static void disposeCursors() {
+ for (Cursor cursor : m_idToCursorMap.values()) {
+ cursor.dispose();
+ }
+ m_idToCursorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeImages();
+ disposeFonts();
+ disposeCursors();
+ }
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/HashingPlugin.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/HashingPlugin.java
new file mode 100755
index 0000000..e452fd4
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/HashingPlugin.java
@@ -0,0 +1,63 @@
+package org.jcryptool.visual.sha3candidates;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class HashingPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jcryptool.visual.sha3candidates"; //$NON-NLS-1$
+
+ // The shared instance
+ private static HashingPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public HashingPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static HashingPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAction.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAction.java
new file mode 100755
index 0000000..e07b8f0
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAction.java
@@ -0,0 +1,33 @@
+// -----BEGIN DISCLAIMER-----
+/*******************************************************************************
+ * Copyright (c) 2010 JCrypTool team and contributors
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+// -----END DISCLAIMER-----
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.BLAKEAlgorithm;
+/**
+ * The action class of ECHO.
+ *
+ * @author Daniel Finn
+ *
+ */
+
+
+
+public class BLAKEAction {
+ public byte[] run(int hashlength, String str) {
+ BLAKEAlgorithm e = new BLAKEAlgorithm(hashlength, str.getBytes());
+ return e.getHash();
+ }
+
+ public byte[] run(int hashlength, String str, String salt) {
+ BLAKEAlgorithm e = new BLAKEAlgorithm(hashlength, str.getBytes(), salt);
+ return e.getHash();
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAlgorithm.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAlgorithm.java
new file mode 100755
index 0000000..980f203
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/BLAKEAlgorithm.java
@@ -0,0 +1,913 @@
+// -----BEGIN DISCLAIMER-----
+/*******************************************************************************
+ * Copyright (c) 2010 JCrypTool team and contributors
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+// -----END DISCLAIMER-----
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.BLAKEHashState;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+public class BLAKEAlgorithm {
+ private int SUCCESS=0;
+ private int FAIL=1;
+ private int BAD_HASHBITLEN=2;
+
+ private BLAKEHashState state;
+ private byte hashval[];
+ private int status;
+
+ public static final byte padding[] =
+ {
+ (byte)0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ /*
+ constants for BLAKE-32 and BLAKE-28
+ */
+ public static final long c32[] = {
+ 0x243F6A88, 0x85A308D3,
+ 0x13198A2E, 0x03707344,
+ 0xA4093822, 0x299F31D0,
+ 0x082EFA98, 0xEC4E6C89,
+ 0x452821E6, 0x38D01377,
+ 0xBE5466CF, 0x34E90C6C,
+ 0xC0AC29B7, 0xC97C50DD,
+ 0x3F84D5B5, 0xB5470917
+ };
+
+ /*
+ constants for BLAKE-64 and BLAKE-48
+ */
+ public static final long c64[] = {
+ 0x243F6A8885A308D3L,0x13198A2E03707344L,
+ 0xA4093822299F31D0L,0x082EFA98EC4E6C89L,
+ 0x452821E638D01377L,0xBE5466CF34E90C6CL,
+ 0xC0AC29B7C97C50DDL,0x3F84D5B5B5470917L,
+ 0x9216D5D98979FB1BL,0xD1310BA698DFB5ACL,
+ 0x2FFD72DBD01ADFB7L,0xB8E1AFED6A267E96L,
+ 0xBA7C9045F12C7F99L,0x24A19947B3916CF7L,
+ 0x0801F2E2858EFC16L,0x636920D871574E69L
+ };
+ /*public static final BigInteger c64[] = {
+ new BigInteger("0x243F6A8885A308D3"),new BigInteger("0x13198A2E03707344"),
+ new BigInteger("0xA4093822299F31D0"),new BigInteger("0x082EFA98EC4E6C89"),
+ new BigInteger("0x452821E638D01377"),new BigInteger("0xBE5466CF34E90C6C"),
+ new BigInteger("0xC0AC29B7C97C50DD"),new BigInteger("0x3F84D5B5B5470917"),
+ new BigInteger("0x9216D5D98979FB1B"),new BigInteger("0xD1310BA698DFB5AC"),
+ new BigInteger("0x2FFD72DBD01ADFB7"),new BigInteger("0xB8E1AFED6A267E96"),
+ new BigInteger("0xBA7C9045F12C7F99"),new BigInteger("0x24A19947B3916CF7"),
+ new BigInteger("0x0801F2E2858EFC16"),new BigInteger("0x636920D871574E69")
+ };*/
+
+ public static final int IV256[]={
+ 0x6A09E667, 0xBB67AE85,
+ 0x3C6EF372, 0xA54FF53A,
+ 0x510E527F, 0x9B05688C,
+ 0x1F83D9AB, 0x5BE0CD19
+ };
+ public static final int IV224[]={
+ 0xC1059ED8, 0x367CD507,
+ 0x3070DD17, 0xF70E5939,
+ 0xFFC00B31, 0x68581511,
+ 0x64F98FA7, 0xBEFA4FA4
+ };
+ public static final long IV384[]={
+ 0xCBBB9D5DC1059ED8L, 0x629A292A367CD507L,
+ 0x9159015A3070DD17L, 0x152FECD8F70E5939L,
+ 0x67332667FFC00B31L, 0x8EB44A8768581511L,
+ 0xDB0C2E0D64F98FA7L, 0x47B5481DBEFA4FA4L
+ };
+ public static final long IV512[]={
+ 0x6A09E667F3BCC908L, 0xBB67AE8584CAA73BL,
+ 0x3C6EF372FE94F82BL, 0xA54FF53A5F1D36F1L,
+ 0x510E527FADE682D1L, 0x9B05688C2B3E6C1FL,
+ 0x1F83D9ABFB41BD6BL, 0x5BE0CD19137E2179L
+ };
+
+ private static short sigma[][] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 }
+ };
+
+
+ public BLAKEAlgorithm(int hashbitlen, byte[] data) {
+ this.status = FAIL;
+ this.hashval = new byte[hashbitlen/8];
+ this.state = new BLAKEHashState();
+
+ if (hashbitlen < 384){
+ state.salt32[0] = 0;
+ state.salt32[1] = 0;
+ state.salt32[2] = 0;
+ state.salt32[3] = 0;
+ }
+ else{
+ state.salt64[0] = 0;
+ state.salt64[1] = 0;
+ state.salt64[2] = 0;
+ state.salt64[3] = 0;
+ }
+
+ status = Hash(hashbitlen, data, 8);
+ }
+
+
+ public BLAKEAlgorithm(int hashbitlen, byte[] data, String salt) {
+ this.status = FAIL;
+ this.hashval = new byte[hashbitlen/8];
+ this.state = new BLAKEHashState();
+
+ AddSalt(hexStrToByteField(salt));
+
+ status = Hash(hashbitlen, data, 8);
+ }
+
+
+ public int getStatus(){
+ return this.status;
+ }
+
+ public byte[] getHash(){
+ return this.hashval;
+ }
+
+ private long ROT32(long x, long n){
+ return (((x<<(32-n))|(x>>n))& 0xffffffffL);
+ }
+
+ private long ADD32(long x, long y){
+ return ((x + y) & 0xffffffffL);
+ }
+
+ private long XOR32(long x, long y){
+ return ((x ^ y) & 0xffffffffL);
+ }
+
+ private long[] G32(long v[], long m[], short round,
+ int a, int b, int c, int d, int i){
+ v[a] = ADD32(v[a],v[b])+XOR32(m[sigma[round][2*i]], c32[sigma[round][2*i+1]]);
+ v[d] = ROT32(XOR32(v[d],v[a]),16);
+ v[c] = ADD32(v[c],v[d]);
+ v[b] = ROT32(XOR32(v[b],v[c]),12);
+ v[a] = ADD32(v[a],v[b])+XOR32(m[sigma[round][2*i+1]], c32[sigma[round][2*i]]);
+ v[d] = ROT32(XOR32(v[d],v[a]), 8);
+ v[c] = ADD32(v[c],v[d]);
+ v[b] = ROT32(XOR32(v[b],v[c]), 7);
+
+ return v;
+ }
+
+ private int compress32(byte[] datablock){
+
+ long v[] = new long[16];
+ long m[] = new long[16];
+ short round;
+
+
+ /* get message */
+ m[0] = U8TO32_BE(Arrays.copyOfRange(datablock,0,4));
+ m[1] = U8TO32_BE(Arrays.copyOfRange(datablock,4,8));
+ m[2] = U8TO32_BE(Arrays.copyOfRange(datablock,8,12));
+ m[3] = U8TO32_BE(Arrays.copyOfRange(datablock,12,16));
+ m[4] = U8TO32_BE(Arrays.copyOfRange(datablock,16,20));
+ m[5] = U8TO32_BE(Arrays.copyOfRange(datablock,20,24));
+ m[6] = U8TO32_BE(Arrays.copyOfRange(datablock,24,28));
+ m[7] = U8TO32_BE(Arrays.copyOfRange(datablock,28,32));
+ m[8] = U8TO32_BE(Arrays.copyOfRange(datablock,32,36));
+ m[9] = U8TO32_BE(Arrays.copyOfRange(datablock,36,40));
+ m[10] = U8TO32_BE(Arrays.copyOfRange(datablock,40,44));
+ m[11] = U8TO32_BE(Arrays.copyOfRange(datablock,44,48));
+ m[12] = U8TO32_BE(Arrays.copyOfRange(datablock,48,52));
+ m[13] = U8TO32_BE(Arrays.copyOfRange(datablock,52,56));
+ m[14] = U8TO32_BE(Arrays.copyOfRange(datablock,56,60));
+ m[15] = U8TO32_BE(Arrays.copyOfRange(datablock,60,64));
+
+ /* initialization */
+ v[ 0] = state.h32[0] & 0xffffffffL;
+ v[ 1] = state.h32[1] & 0xffffffffL;
+ v[ 2] = state.h32[2] & 0xffffffffL;
+ v[ 3] = state.h32[3] & 0xffffffffL;
+ v[ 4] = state.h32[4] & 0xffffffffL;
+ v[ 5] = state.h32[5] & 0xffffffffL;
+ v[ 6] = state.h32[6] & 0xffffffffL;
+ v[ 7] = state.h32[7] & 0xffffffffL;
+ v[ 8] = (state.salt32[0] ^ c32[0]) & 0xffffffffL;
+ v[ 9] = (state.salt32[1] ^ c32[1]) & 0xffffffffL;
+ v[10] = (state.salt32[2] ^ c32[2]) & 0xffffffffL;
+ v[11] = (state.salt32[3] ^ c32[3]) & 0xffffffffL;
+ if (state.nullt != 0) { /* special case t=0 for the last block */
+ v[12] = c32[4] & 0xffffffffL;
+ v[13] = c32[5] & 0xffffffffL;
+ v[14] = c32[6] & 0xffffffffL;
+ v[15] = c32[7] & 0xffffffffL;
+ }
+ else {
+ v[12] = (state.t32[0] ^ c32[4]) & 0xffffffffL;
+ v[13] = (state.t32[0] ^ c32[5]) & 0xffffffffL;
+ v[14] = (state.t32[1] ^ c32[6]) & 0xffffffffL;
+ v[15] = (state.t32[1] ^ c32[7]) & 0xffffffffL;
+ }
+
+ /* do 14 rounds */
+ for(round=0; round<14; ++round) {
+
+ /* column step */
+ v = G32(v, m, round, 0, 4, 8,12, 0);
+ v = G32(v, m, round, 1, 5, 9,13, 1);
+ v = G32(v, m, round, 2, 6,10,14, 2);
+ v = G32(v, m, round, 3, 7,11,15, 3);
+
+ /* diagonal step */
+ v = G32(v, m, round, 0, 5,10,15, 4);
+ v = G32(v, m, round, 1, 6,11,12, 5);
+ v = G32(v, m, round, 2, 7, 8,13, 6);
+ v = G32(v, m, round, 3, 4, 9,14, 7);
+
+ }
+
+ /* finalization */
+ state.h32[0] ^= v[ 0]^v[ 8]^state.salt32[0];
+ state.h32[1] ^= v[ 1]^v[ 9]^state.salt32[1];
+ state.h32[2] ^= v[ 2]^v[10]^state.salt32[2];
+ state.h32[3] ^= v[ 3]^v[11]^state.salt32[3];
+ state.h32[4] ^= v[ 4]^v[12]^state.salt32[0];
+ state.h32[5] ^= v[ 5]^v[13]^state.salt32[1];
+ state.h32[6] ^= v[ 6]^v[14]^state.salt32[2];
+ state.h32[7] ^= v[ 7]^v[15]^state.salt32[3];
+
+ return SUCCESS;
+ }
+
+ private long ROT64(long x, int n){
+ long y;
+ y = x << (64-n);
+ return y | (x >>> n);
+ }
+
+ private long ADD64(long x, long y){
+ return (x + y);
+ }
+
+ private long XOR64(long x, long y){
+ return (x ^ y);
+ }
+
+ private long[] G64(long v[], long m[], short round,
+ int a, int b, int c, int d, int i){
+ v[a] = ADD64(v[a],v[b])+XOR64(m[sigma[round][2*i]], c64[sigma[round][2*i+1]]);
+ v[d] = ROT64(XOR64(v[d],v[a]),32);
+ v[c] = ADD64(v[c],v[d]);
+ v[b] = ROT64(XOR64(v[b],v[c]),25);
+ v[a] = ADD64(v[a],v[b])+XOR64(m[sigma[round][2*i+1]], c64[sigma[round][2*i]]);
+ v[d] = ROT64(XOR64(v[d],v[a]),16);
+ v[c] = ADD64(v[c],v[d]);
+ v[b] = ROT64(XOR64(v[b],v[c]),11);
+
+ return v;
+ }
+
+ private long compress64(byte[] data ) {
+
+ long v[] = new long[16];
+ long m[] = new long[16];
+ short round;
+
+ /* get message */
+ m[0] = U8TO64_BE(Arrays.copyOfRange(data,0,8));
+ m[1] = U8TO64_BE(Arrays.copyOfRange(data,8,16));
+ m[2] = U8TO64_BE(Arrays.copyOfRange(data,16,24));
+ m[3] = U8TO64_BE(Arrays.copyOfRange(data,24,32));
+ m[4] = U8TO64_BE(Arrays.copyOfRange(data,32,40));
+ m[5] = U8TO64_BE(Arrays.copyOfRange(data,40,48));
+ m[6] = U8TO64_BE(Arrays.copyOfRange(data,48,56));
+ m[7] = U8TO64_BE(Arrays.copyOfRange(data,56,64));
+ m[8] = U8TO64_BE(Arrays.copyOfRange(data,64,72));
+ m[9] = U8TO64_BE(Arrays.copyOfRange(data,72,80));
+ m[10] = U8TO64_BE(Arrays.copyOfRange(data,80,88));
+ m[11] = U8TO64_BE(Arrays.copyOfRange(data,88,96));
+ m[12] = U8TO64_BE(Arrays.copyOfRange(data,96,104));
+ m[13] = U8TO64_BE(Arrays.copyOfRange(data,104,112));
+ m[14] = U8TO64_BE(Arrays.copyOfRange(data,112,120));
+ m[15] = U8TO64_BE(Arrays.copyOfRange(data,120,128));
+
+ /* initialization */
+ v[0] = state.h64[0];
+ v[1] = state.h64[1];
+ v[2] = state.h64[2];
+ v[3] = state.h64[3];
+ v[4] = state.h64[4];
+ v[5] = state.h64[5];
+ v[6] = state.h64[6];
+ v[7] = state.h64[7];
+ v[ 8] = state.salt64[0] ^ c64[0];
+ v[ 9] = state.salt64[1] ^ c64[1];
+ v[10] = state.salt64[2] ^ c64[2];
+ v[11] = state.salt64[3] ^ c64[3];
+ if (state.nullt != 0) {
+ v[12] = c64[4];
+ v[13] = c64[5];
+ v[14] = c64[6];
+ v[15] = c64[7];
+ }
+ else {
+ v[12] = state.t64[0] ^ c64[4];
+ v[13] = state.t64[0] ^ c64[5];
+ v[14] = state.t64[1] ^ c64[6];
+ v[15] = state.t64[1] ^ c64[7];
+ }
+
+ /* do 16 rounds */
+ for(round=0; round<16; ++round) {
+
+ /* column step */
+ v = G64(v, m, round, 0, 4, 8,12, 0);
+ v = G64(v, m, round, 1, 5, 9,13, 1);
+ v = G64(v, m, round, 2, 6,10,14, 2);
+ v = G64(v, m, round, 3, 7,11,15, 3);
+ /* diagonal step */
+ v = G64(v, m, round, 0, 5,10,15, 4);
+ v = G64(v, m, round, 1, 6,11,12, 5);
+ v = G64(v, m, round, 2, 7, 8,13, 6);
+ v = G64(v, m, round, 3, 4, 9,14, 7);
+ }
+
+
+ /* finalization */
+ state.h64[0] ^= v[ 0]^v[ 8]^state.salt64[0];
+ state.h64[1] ^= v[ 1]^v[ 9]^state.salt64[1];
+ state.h64[2] ^= v[ 2]^v[10]^state.salt64[2];
+ state.h64[3] ^= v[ 3]^v[11]^state.salt64[3];
+ state.h64[4] ^= v[ 4]^v[12]^state.salt64[0];
+ state.h64[5] ^= v[ 5]^v[13]^state.salt64[1];
+ state.h64[6] ^= v[ 6]^v[14]^state.salt64[2];
+ state.h64[7] ^= v[ 7]^v[15]^state.salt64[3];
+
+ return SUCCESS;
+ }
+
+ private int Init(int hashbitlen){
+ int i;
+
+ if ( (hashbitlen == 224) || (hashbitlen == 256) ) {
+
+ if (hashbitlen == 224)
+ System.arraycopy(IV224, 0, state.h32, 0, IV224.length);
+ else
+ System.arraycopy(IV256, 0, state.h32, 0, IV256.length);
+
+ state.t32[0] = 0;
+ state.t32[1] = 0;
+
+ for(i=0; i<64; ++i)
+ state.data32[i] = 0;
+
+ }
+ else if ( (hashbitlen == 384) || (hashbitlen == 512) ){
+ /* 384- and 512-bit versions (64-bit words) */
+
+ if (hashbitlen == 384)
+ System.arraycopy(IV384, 0, state.h64, 0, IV384.length);
+ else
+ System.arraycopy(IV512, 0, state.h64, 0, IV512.length );
+
+ state.t64[0] = 0;
+ state.t64[1] = 0;
+
+ for(i=0; i<64; ++i)
+ state.data64[i] = 0;
+
+ }
+ else
+ return BAD_HASHBITLEN;
+
+ state.hashbitlen = (short)hashbitlen;
+ state.datalen = 0;
+ state.init = 1;
+ state.nullt = 0;
+
+ return SUCCESS;
+ }
+
+ private int AddSalt(byte[] salt ) {
+
+ /* if hashbitlen=224 or 256, then the salt should be 128-bit (16 shorts) */
+ /* if hashbitlen=384 or 512, then the salt should be 256-bit (32 shorts) */
+
+ /* fail if Init() was not called before */
+ if (state.init != 0)
+ return FAIL;
+
+ if ( state.hashbitlen < 384) {
+ if (salt.length >= 16){
+ state.salt32[0] = U8TO32_BE(Arrays.copyOfRange(salt,0,4));
+ state.salt32[1] = U8TO32_BE(Arrays.copyOfRange(salt,4,8));
+ state.salt32[2] = U8TO32_BE(Arrays.copyOfRange(salt,8,12));
+ state.salt32[3] = U8TO32_BE(Arrays.copyOfRange(salt,12,16));
+ }
+ else{
+ state.salt32[0] = 0;
+ state.salt32[1] = 0;
+ state.salt32[2] = 0;
+ state.salt32[3] = 0;
+ }
+ }
+ else {
+ if(salt.length >= 32){
+ state.salt64[0] = U8TO64_BE(Arrays.copyOfRange(salt,0,8));
+ state.salt64[1] = U8TO64_BE(Arrays.copyOfRange(salt,8,16));
+ state.salt64[2] = U8TO64_BE(Arrays.copyOfRange(salt,16,24));
+ state.salt64[3] = U8TO64_BE(Arrays.copyOfRange(salt,24,32));
+ }
+ else{
+ state.salt64[0] = 0;
+ state.salt64[1] = 0;
+ state.salt64[2] = 0;
+ state.salt64[3] = 0;
+ }
+ }
+
+ return SUCCESS;
+ }
+
+ private int Update32(byte[] data, long databitlen ) {
+
+
+ long fill;
+ long left; /* to handle data inputs of up to 2^64-1 bits */
+
+ if ( ( databitlen == 0 ) && (state.datalen != 512 ) )
+ return SUCCESS;
+
+ left = (state.datalen >> 3);
+ fill = 64 - left;
+
+ /* compress remaining data filled with new bits */
+ if( left !=0 && ( ((databitlen >> 3) & 0x3F) >= fill ) ) {
+ System.arraycopy(data, 0, state.data32, (int)left, (int)(fill));
+ /* update counter */
+ state.t32[0] += 512;
+ if (state.t32[0] == 0)
+ state.t32[1]++;
+
+ compress32(state.data32);
+ databitlen -= (fill << 3);
+
+ left = 0;
+ }
+
+ /* compress data until enough for a block */
+ while( databitlen >= 512 ) {
+
+ /* update counter */
+ state.t32[0] += 512;
+
+ if (state.t32[0] == 0)
+ state.t32[1]++;
+ compress32(data);
+ databitlen -= 512;
+ }
+
+ if( databitlen > 0 ) {
+ System.arraycopy(data, 0, state.data32, (int)(left), (int)databitlen>>3);
+ state.datalen = (left<<3) + (int)databitlen;
+ /* when non-8-multiple, add remaining bits (1 to 7)*/
+ if ( (databitlen & 0x7) != 0)
+ state.data32[(int) ((int)(left) + (databitlen>>3))] = data[(int) (databitlen>>3)];
+ }
+ else
+ state.datalen=0;
+
+
+ return SUCCESS;
+ }
+
+ private int Update64(byte[] data, long databitlen ) {
+
+
+ long fill;
+ long left;
+
+ if ( ( databitlen == 0 ) && (state.datalen != 1024 ) )
+ return SUCCESS;
+
+ left = (state.datalen >> 3);
+ fill = 128L - left;
+
+ /* compress remaining data filled with new bits */
+ if( left!= 0 && ( ((databitlen >> 3) & 0x7F) >= fill ) ) {
+
+ System.arraycopy(data, 0, state.data64, (int)left,(int)fill);
+ /* update counter */
+ state.t64[0] += 1024;
+
+ compress64(state.data64);
+
+ databitlen -= (fill << 3);
+
+ left = 0;
+ }
+
+ /* compress data until enough for a block */
+ while( databitlen >= 1024 ) {
+
+ /* update counter */
+ state.t64[0] += 1024;
+ compress64(data);
+ databitlen -= 1024;
+ }
+
+ if( databitlen > 0 ) {
+ System.arraycopy(data, 0, state.data64, (int)left, (int)(databitlen>>3) & 0x7F);
+ state.datalen = (int) ((left<<3) + databitlen);
+
+ /* when non-8-multiple, add remaining bits (1 to 7)*/
+ if ( (databitlen & 0x7) !=0 )
+ state.data64[(int) (left + (databitlen>>3))] = data[(int) (databitlen>>3)];
+ }
+ else
+ state.datalen=0;
+
+ return SUCCESS;
+ }
+
+ private int Update(byte[] data, int databitlen) {
+
+ if ( state.hashbitlen < 384 )
+ return Update32(data, databitlen );
+ else
+ return Update64(data, databitlen);
+ }
+
+ private int Final32() {
+ byte msglen[] = new byte [8];
+ byte[] zz={(byte)0x00};
+ byte[] zo={(byte)0x01};
+ byte[] oz={(byte)0x80};
+ byte[] oo={(byte)0x81};
+
+ /*
+ copy nb. bits hash in total as a 64-bit BE word
+ */
+ long low, high;
+ low = state.t32[0] + state.datalen;
+ high = state.t32[1];
+ if ( low < state.datalen )
+ high++;
+ byte[] msglen0 = U32TO8_BE((int)high);
+ byte[] msglen1 = U32TO8_BE((int)low);
+ ByteBuffer msg = ByteBuffer.wrap(msglen);
+ msg.put(msglen0);
+ msg.put(msglen1);
+
+ if ( state.datalen % 8 == 0) {
+ /* message bitlength multiple of 8 */
+
+ if ( state.datalen == 440 ) {
+ /* special case of one padding short */
+ state.t32[0] -= 8;
+ if ( state.hashbitlen == 224 )
+ Update32(oz, 8 );
+ else
+ Update32(oo, 8 );
+ }
+ else {
+ if ( state.datalen < 440 ) {
+ /* use t=0 if no remaining data */
+ if ( state.datalen == 0 )
+ state.nullt=1;
+ /* enough space to fill the block */
+ state.t32[0] -= 440 - state.datalen;
+ Update32(padding, 440 - state.datalen );
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t32[0] -= 512 - state.datalen;
+ Update32(padding, 512 - state.datalen );
+ state.t32[0] -= 440;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 440 ); /* padd with zeroes */
+ state.nullt = 1; /* raise flag to set t=0 at the next compress */
+ }
+ if ( state.hashbitlen == 224 )
+ Update32(zz, 8 );
+ else
+ Update32(zo, 8 );
+ state.t32[0] -= 8;
+ }
+ state.t32[0] -= 64;
+ Update32(msglen, 64L );
+ }
+ else {
+ /* message bitlength NOT multiple of 8 */
+
+ /* add '1' */
+ state.data32[(int) (state.datalen/8)] &= (0xFF << (8-state.datalen%8));
+ state.data32[(int) (state.datalen/8)] ^= (0x80 >> (state.datalen%8));
+
+ if (( state.datalen > 440 ) && ( state.datalen < 447 )) {
+ /* special case of one padding short */
+ if ( state.hashbitlen == 224 )
+ state.data32[(int) (state.datalen/8)] ^= 0x00;
+ else
+ state.data32[(int) (state.datalen/8)] ^= 0x01;
+ state.t32[0] -= (8 - (state.datalen%8));
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ }
+ else {
+ if (state.datalen < 440) {
+ /* enough space to fill the block */
+ state.t32[0] -= 440 - state.datalen;
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update(Arrays.copyOfRange(padding,1,padding.length), (int)(440 - state.datalen) );
+ }
+ else {
+ if (state.datalen > 504 ) {
+ /* special case */
+ state.t32[0] -= 512 - state.datalen;
+ state.datalen=512;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 0 );
+ state.t32[0] -= 440;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 440 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t32[0] -= 512 - state.datalen;
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 512 - state.datalen );
+ state.t32[0] -= 440;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 440 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ }
+ state.t32[0] -= 8;
+ if ( state.hashbitlen == 224 )
+ Update32(zz, 8 );
+ else
+ Update32(zo, 8 );
+ }
+ state.t32[0] -= 64;
+ Update32(msglen, 64L );
+ }
+
+ byte[] hashval0 = U32TO8_BE(state.h32[0]);
+ byte[] hashval1 = U32TO8_BE(state.h32[1]);
+ byte[] hashval2 = U32TO8_BE(state.h32[2]);
+ byte[] hashval3 = U32TO8_BE(state.h32[3]);
+ byte[] hashval4 = U32TO8_BE(state.h32[4]);
+ byte[] hashval5 = U32TO8_BE(state.h32[5]);
+ byte[] hashval6 = U32TO8_BE(state.h32[6]);
+
+ ByteBuffer target = ByteBuffer.wrap(hashval);
+ target.put(hashval0);
+ target.put(hashval1);
+ target.put(hashval2);
+ target.put(hashval3);
+ target.put(hashval4);
+ target.put(hashval5);
+ target.put(hashval6);
+
+ if ( state.hashbitlen == 256 ) {
+ byte[] hashval7 = U32TO8_BE(state.h32[7]);
+ target.put(hashval7);
+ }
+
+ return SUCCESS;
+ }
+
+ private int Final64() {
+
+
+ byte msglen[] = new byte [16];
+ byte[] zz={(byte)0x00};
+ byte[] zo={(byte)0x01};
+ byte[] oz={(byte)0x80};
+ byte[] oo={(byte)0x81};
+
+ /* copy nb. bits hash in total as a 128-bit BE word */
+ long low, high;
+ low = state.t64[0] + state.datalen;
+ high = state.t64[1];
+ if ( low < state.datalen )
+ high = high + 1;
+ byte[] msglen0 = U64TO8_BE(high);
+ byte[] msglen1 = U64TO8_BE(low);
+ ByteBuffer msg = ByteBuffer.wrap(msglen);
+ msg.put(msglen0);
+ msg.put(msglen1);
+
+ if ( state.datalen % 8 == 0) {
+ /* message bitlength multiple of 8 */
+
+ if ( state.datalen == 888 ) {
+ /* special case of one padding short */
+ state.t64[0] -= 8;
+ if ( state.hashbitlen == 384 )
+ Update64(oz, 8 );
+ else
+ Update64(oo, 8 );
+ }
+ else {
+ if ( state.datalen < 888 ) {
+ /* use t=0 if no remaining data */
+ if ( state.datalen == 0 )
+ state.nullt=1;
+ /* enough space to fill the block */
+ state.t64[0] -= 888 - state.datalen;
+ Update64(padding, 888 - state.datalen );
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t64[0] -= 1024 - state.datalen;
+ Update64(padding, 1024 - state.datalen );
+ state.t64[0] -= 888;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 ); /* padd with zeros */
+ state.nullt = 1; /* raise flag to set t=0 at the next compress */
+ }
+ if ( state.hashbitlen == 384 )
+ Update64(zz, 8 );
+ else
+ Update(zo, 8 );
+ state.t64[0] -= 8;
+ }
+ state.t64[0] -= 128;
+ Update(msglen, 128 );
+ }
+ else {
+ /* message bitlength NOT multiple of 8 */
+
+ /* add '1' */
+ state.data64[(int) (state.datalen/8)] &= (0xFF << (8-state.datalen%8));
+ state.data64[(int) (state.datalen/8)] ^= (0x80 >> (state.datalen%8));
+
+ if (( state.datalen > 888 ) && ( state.datalen < 895 )) {
+ /* special case of one padding short */
+ if ( state.hashbitlen == 384 )
+ state.data64[(int) (state.datalen/8)] ^= 0x00;
+ else
+ state.data64[(int) (state.datalen/8)] ^= 0x01;
+ state.t64[0] -= (8 - (state.datalen%8));
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ }
+ else {
+ if (state.datalen < 888) {
+ /* enough space to fill the block */
+ state.t64[0] -= 888 - state.datalen;
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 - state.datalen );
+ }
+ else {
+ if (state.datalen > 1016 ) {
+ /* special case */
+ state.t64[0] -= 1024 - state.datalen;
+ state.datalen=1024;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 0 );
+ state.t64[0] -= 888;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t64[0] -= 1024 - state.datalen;
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 1024 - state.datalen );
+ state.t64[0] -= 888;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ }
+ state.t64[0] -= 8;
+ if ( state.hashbitlen == 384 )
+ Update64(zz, 8 );
+ else
+ Update64(zo, 8 );
+ }
+ state.t64[0] -= 128;
+ Update(msglen, 128 );
+ }
+
+ byte[] hashval0 = U64TO8_BE(state.h64[0]);
+ byte[] hashval1 = U64TO8_BE(state.h64[1]);
+ byte[] hashval2 = U64TO8_BE(state.h64[2]);
+ byte[] hashval3 = U64TO8_BE(state.h64[3]);
+ byte[] hashval4 = U64TO8_BE(state.h64[4]);
+ byte[] hashval5 = U64TO8_BE(state.h64[5]);
+
+ ByteBuffer target = ByteBuffer.wrap(hashval);
+ target.put(hashval0);
+ target.put(hashval1);
+ target.put(hashval2);
+ target.put(hashval3);
+ target.put(hashval4);
+ target.put(hashval5);
+
+ if ( state.hashbitlen == 512 ) {
+ byte[] hashval6 = U64TO8_BE(state.h64[6]);
+ byte[] hashval7 = U64TO8_BE(state.h64[7]);
+ target.put(hashval6);
+ target.put(hashval7);
+ }
+
+ return SUCCESS;
+ }
+
+ private int Final(){
+ if (state.hashbitlen < 384 )
+ return Final32();
+ else
+ return Final64();
+ }
+
+ private int Hash(int hashbitlen,byte[] data, int databitlen){
+ int ret;
+ ret = Init(hashbitlen);
+ if ( ret != SUCCESS ){
+ return ret;
+ }
+
+ ret = Update(data, databitlen);
+ if ( ret != SUCCESS ){
+ return ret;
+ }
+
+ ret = Final();
+ return ret;
+ }
+
+ private static int U8TO32_BE(byte[] p){
+ int q = java.nio.ByteBuffer.wrap(p).getInt();
+ return q; }
+ private static long U8TO64_BE(byte[] p){
+ int int1 = U8TO32_BE(Arrays.copyOfRange(p,0,4));
+ int int2 = U8TO32_BE(Arrays.copyOfRange(p,4,8));
+ long q = (((long)int1) << 32) | ((long)int2 & 0xffffffffL);
+ return q;
+ }
+ private static byte[] U32TO8_BE(int v){
+ ByteBuffer b = ByteBuffer.allocate(4);
+ b.putInt(v);
+ byte[] p = b.array();
+ return p;
+ }
+
+ private static byte[] U64TO8_BE(long v){
+ byte [] p1=U32TO8_BE((int)((v) >> 32));
+ byte [] p2=U32TO8_BE((int)((v)));
+ byte [] p3=new byte[8];
+ for(int i=0; i<4; i++) {
+ Arrays.fill(p3, i, i+1, p1[i]);
+ Arrays.fill(p3, i+4, i+5, p2[i]);
+ }
+ return p3;
+ }
+ private byte[] hexStrToByteField(String hexStr){
+ if(hexStr.length()%2==0){
+ byte [] bytes = new byte[hexStr.length()/2];
+ int i,j;
+
+ try{
+ for(i=0,j=0;j>n))& 0xffffffffL);
+ }
+
+ private long ADD32(long x, long y){
+ return ((x + y) & 0xffffffffL);
+ }
+
+ private long XOR32(long x, long y){
+ return ((x ^ y) & 0xffffffffL);
+ }
+
+ private long[] G32(long v[], long m[], short round,
+ int a, int b, int c, int d, int i){
+ v[a] = ADD32(v[a],v[b])+XOR32(m[sigma[round][2*i]], c32[sigma[round][2*i+1]]);
+ v[d] = ROT32(XOR32(v[d],v[a]),16);
+ v[c] = ADD32(v[c],v[d]);
+ v[b] = ROT32(XOR32(v[b],v[c]),12);
+ v[a] = ADD32(v[a],v[b])+XOR32(m[sigma[round][2*i+1]], c32[sigma[round][2*i]]);
+ v[d] = ROT32(XOR32(v[d],v[a]), 8);
+ v[c] = ADD32(v[c],v[d]);
+ v[b] = ROT32(XOR32(v[b],v[c]), 7);
+
+ return v;
+ }
+
+ private int compress32(byte[] datablock){
+
+ long v[] = new long[16];
+ long m[] = new long[16];
+ short check[] = new short[4];
+ short round;
+
+
+ /* get message */
+ m[0] = U8TO32_BE(Arrays.copyOfRange(datablock,0,4));
+ m[1] = U8TO32_BE(Arrays.copyOfRange(datablock,4,8));
+ m[2] = U8TO32_BE(Arrays.copyOfRange(datablock,8,12));
+ m[3] = U8TO32_BE(Arrays.copyOfRange(datablock,12,16));
+ m[4] = U8TO32_BE(Arrays.copyOfRange(datablock,16,20));
+ m[5] = U8TO32_BE(Arrays.copyOfRange(datablock,20,24));
+ m[6] = U8TO32_BE(Arrays.copyOfRange(datablock,24,28));
+ m[7] = U8TO32_BE(Arrays.copyOfRange(datablock,28,32));
+ m[8] = U8TO32_BE(Arrays.copyOfRange(datablock,32,36));
+ m[9] = U8TO32_BE(Arrays.copyOfRange(datablock,36,40));
+ m[10] = U8TO32_BE(Arrays.copyOfRange(datablock,40,44));
+ m[11] = U8TO32_BE(Arrays.copyOfRange(datablock,44,48));
+ m[12] = U8TO32_BE(Arrays.copyOfRange(datablock,48,52));
+ m[13] = U8TO32_BE(Arrays.copyOfRange(datablock,52,56));
+ m[14] = U8TO32_BE(Arrays.copyOfRange(datablock,56,60));
+ m[15] = U8TO32_BE(Arrays.copyOfRange(datablock,60,64));
+
+ /* initialization */
+ v[ 0] = state.h32[0] & 0xffffffffL;
+ v[ 1] = state.h32[1] & 0xffffffffL;
+ v[ 2] = state.h32[2] & 0xffffffffL;
+ v[ 3] = state.h32[3] & 0xffffffffL;
+ v[ 4] = state.h32[4] & 0xffffffffL;
+ v[ 5] = state.h32[5] & 0xffffffffL;
+ v[ 6] = state.h32[6] & 0xffffffffL;
+ v[ 7] = state.h32[7] & 0xffffffffL;
+ v[ 8] = (state.salt32[0] ^ c32[0]) & 0xffffffffL;
+ v[ 9] = (state.salt32[1] ^ c32[1]) & 0xffffffffL;
+ v[10] = (state.salt32[2] ^ c32[2]) & 0xffffffffL;
+ v[11] = (state.salt32[3] ^ c32[3]) & 0xffffffffL;
+ if (state.nullt != 0) { /* special case t=0 for the last block */
+ v[12] = c32[4] & 0xffffffffL;
+ v[13] = c32[5] & 0xffffffffL;
+ v[14] = c32[6] & 0xffffffffL;
+ v[15] = c32[7] & 0xffffffffL;
+ }
+ else {
+ v[12] = (state.t32[0] ^ c32[4]) & 0xffffffffL;
+ v[13] = (state.t32[0] ^ c32[5]) & 0xffffffffL;
+ v[14] = (state.t32[1] ^ c32[6]) & 0xffffffffL;
+ v[15] = (state.t32[1] ^ c32[7]) & 0xffffffffL;
+ }
+
+ /* do 14 rounds */
+ for(round=0; round<14; ++round) {
+
+ /* column step */
+ v = G32(v, m, round, 0, 4, 8,12, 0);
+ v = G32(v, m, round, 1, 5, 9,13, 1);
+ v = G32(v, m, round, 2, 6,10,14, 2);
+ v = G32(v, m, round, 3, 7,11,15, 3);
+
+ /* diagonal step */
+ v = G32(v, m, round, 0, 5,10,15, 4);
+ v = G32(v, m, round, 1, 6,11,12, 5);
+ v = G32(v, m, round, 2, 7, 8,13, 6);
+ v = G32(v, m, round, 3, 4, 9,14, 7);
+
+ }
+
+ /* finalization */
+ state.h32[0] ^= v[ 0]^v[ 8]^state.salt32[0];
+ state.h32[1] ^= v[ 1]^v[ 9]^state.salt32[1];
+ state.h32[2] ^= v[ 2]^v[10]^state.salt32[2];
+ state.h32[3] ^= v[ 3]^v[11]^state.salt32[3];
+ state.h32[4] ^= v[ 4]^v[12]^state.salt32[0];
+ state.h32[5] ^= v[ 5]^v[13]^state.salt32[1];
+ state.h32[6] ^= v[ 6]^v[14]^state.salt32[2];
+ state.h32[7] ^= v[ 7]^v[15]^state.salt32[3];
+
+ return SUCCESS;
+ }
+
+ private long ROT64(long x, int n){
+ long y;
+ y = x << (64-n);
+ return y | (x >>> n);
+ }
+
+ private long ADD64(long x, long y){
+ return (x + y);
+ }
+
+ private long XOR64(long x, long y){
+ return (x ^ y);
+ }
+
+ private long[] G64(long v[], long m[], short round,
+ int a, int b, int c, int d, int i){
+ v[a] = ADD64(v[a],v[b])+XOR64(m[sigma[round][2*i]], c64[sigma[round][2*i+1]]);
+ v[d] = ROT64(XOR64(v[d],v[a]),32);
+ v[c] = ADD64(v[c],v[d]);
+ v[b] = ROT64(XOR64(v[b],v[c]),25);
+ v[a] = ADD64(v[a],v[b])+XOR64(m[sigma[round][2*i+1]], c64[sigma[round][2*i]]);
+ v[d] = ROT64(XOR64(v[d],v[a]),16);
+ v[c] = ADD64(v[c],v[d]);
+ v[b] = ROT64(XOR64(v[b],v[c]),11);
+
+ return v;
+ }
+
+ private long compress64(byte[] data ) {
+
+ long v[] = new long[16];
+ long m[] = new long[16];
+ short round;
+
+ /* get message */
+ m[0] = U8TO64_BE(Arrays.copyOfRange(data,0,8));
+ m[1] = U8TO64_BE(Arrays.copyOfRange(data,8,16));
+ m[2] = U8TO64_BE(Arrays.copyOfRange(data,16,24));
+ m[3] = U8TO64_BE(Arrays.copyOfRange(data,24,32));
+ m[4] = U8TO64_BE(Arrays.copyOfRange(data,32,40));
+ m[5] = U8TO64_BE(Arrays.copyOfRange(data,40,48));
+ m[6] = U8TO64_BE(Arrays.copyOfRange(data,48,56));
+ m[7] = U8TO64_BE(Arrays.copyOfRange(data,56,64));
+ m[8] = U8TO64_BE(Arrays.copyOfRange(data,64,72));
+ m[9] = U8TO64_BE(Arrays.copyOfRange(data,72,80));
+ m[10] = U8TO64_BE(Arrays.copyOfRange(data,80,88));
+ m[11] = U8TO64_BE(Arrays.copyOfRange(data,88,96));
+ m[12] = U8TO64_BE(Arrays.copyOfRange(data,96,104));
+ m[13] = U8TO64_BE(Arrays.copyOfRange(data,104,112));
+ m[14] = U8TO64_BE(Arrays.copyOfRange(data,112,120));
+ m[15] = U8TO64_BE(Arrays.copyOfRange(data,120,128));
+
+ /* initialization */
+ v[0] = state.h64[0];
+ v[1] = state.h64[1];
+ v[2] = state.h64[2];
+ v[3] = state.h64[3];
+ v[4] = state.h64[4];
+ v[5] = state.h64[5];
+ v[6] = state.h64[6];
+ v[7] = state.h64[7];
+ v[ 8] = state.salt64[0] ^ c64[0];
+ v[ 9] = state.salt64[1] ^ c64[1];
+ v[10] = state.salt64[2] ^ c64[2];
+ v[11] = state.salt64[3] ^ c64[3];
+ if (state.nullt != 0) {
+ v[12] = c64[4];
+ v[13] = c64[5];
+ v[14] = c64[6];
+ v[15] = c64[7];
+ }
+ else {
+ v[12] = state.t64[0] ^ c64[4];
+ v[13] = state.t64[0] ^ c64[5];
+ v[14] = state.t64[1] ^ c64[6];
+ v[15] = state.t64[1] ^ c64[7];
+ }
+
+ /* do 16 rounds */
+ for(round=0; round<16; ++round) {
+
+ /* column step */
+ v = G64(v, m, round, 0, 4, 8,12, 0);
+ v = G64(v, m, round, 1, 5, 9,13, 1);
+ v = G64(v, m, round, 2, 6,10,14, 2);
+ v = G64(v, m, round, 3, 7,11,15, 3);
+ /* diagonal step */
+ v = G64(v, m, round, 0, 5,10,15, 4);
+ v = G64(v, m, round, 1, 6,11,12, 5);
+ v = G64(v, m, round, 2, 7, 8,13, 6);
+ v = G64(v, m, round, 3, 4, 9,14, 7);
+ }
+
+
+ /* finalization */
+ state.h64[0] ^= v[ 0]^v[ 8]^state.salt64[0];
+ state.h64[1] ^= v[ 1]^v[ 9]^state.salt64[1];
+ state.h64[2] ^= v[ 2]^v[10]^state.salt64[2];
+ state.h64[3] ^= v[ 3]^v[11]^state.salt64[3];
+ state.h64[4] ^= v[ 4]^v[12]^state.salt64[0];
+ state.h64[5] ^= v[ 5]^v[13]^state.salt64[1];
+ state.h64[6] ^= v[ 6]^v[14]^state.salt64[2];
+ state.h64[7] ^= v[ 7]^v[15]^state.salt64[3];
+
+ return SUCCESS;
+ }
+
+ private int Init(int hashbitlen){
+ int i;
+
+ if ( (hashbitlen == 224) || (hashbitlen == 256) ) {
+
+ if (hashbitlen == 224)
+ System.arraycopy(IV224, 0, state.h32, 0, IV224.length);
+ else
+ System.arraycopy(IV256, 0, state.h32, 0, IV256.length);
+
+ state.t32[0] = 0;
+ state.t32[1] = 0;
+
+ for(i=0; i<64; ++i)
+ state.data32[i] = 0;
+
+ }
+ else if ( (hashbitlen == 384) || (hashbitlen == 512) ){
+ /* 384- and 512-bit versions (64-bit words) */
+
+ if (hashbitlen == 384)
+ System.arraycopy(IV384, 0, state.h64, 0, IV384.length);
+ else
+ System.arraycopy(IV512, 0, state.h64, 0, IV512.length );
+
+ state.t64[0] = 0;
+ state.t64[1] = 0;
+
+ for(i=0; i<64; ++i)
+ state.data64[i] = 0;
+
+ }
+ else
+ return BAD_HASHBITLEN;
+
+ state.hashbitlen = (short)hashbitlen;
+ state.datalen = 0;
+ state.init = 1;
+ state.nullt = 0;
+
+ return SUCCESS;
+ }
+
+ private int AddSalt(byte[] salt ) {
+
+ /* if hashbitlen=224 or 256, then the salt should be 128-bit (16 shorts) */
+ /* if hashbitlen=384 or 512, then the salt should be 256-bit (32 shorts) */
+
+ /* fail if Init() was not called before */
+ if (state.init != 0)
+ return FAIL;
+
+ if ( state.hashbitlen < 384) {
+ state.salt32[0] = U8TO32_BE(Arrays.copyOfRange(salt,0,4));
+ state.salt32[1] = U8TO32_BE(Arrays.copyOfRange(salt,4,8));
+ state.salt32[2] = U8TO32_BE(Arrays.copyOfRange(salt,8,12));
+ state.salt32[3] = U8TO32_BE(Arrays.copyOfRange(salt,12,16));
+ }
+ else {
+ state.salt64[0] = U8TO64_BE(Arrays.copyOfRange(salt,0,8));
+ state.salt64[1] = U8TO64_BE(Arrays.copyOfRange(salt,8,16));
+ state.salt64[2] = U8TO64_BE(Arrays.copyOfRange(salt,16,24));
+ state.salt64[3] = U8TO64_BE(Arrays.copyOfRange(salt,24,32));
+ }
+
+ return SUCCESS;
+ }
+
+ private int Update32(byte[] data, long databitlen ) {
+
+
+ long fill;
+ long left; /* to handle data inputs of up to 2^64-1 bits */
+
+ if ( ( databitlen == 0 ) && (state.datalen != 512 ) )
+ return SUCCESS;
+
+ left = (state.datalen >> 3);
+ fill = 64 - left;
+
+ /* compress remaining data filled with new bits */
+ if( left !=0 && ( ((databitlen >> 3) & 0x3F) >= fill ) ) {
+ System.arraycopy(data, 0, state.data32, (int)left, (int)(fill));
+ /* update counter */
+ state.t32[0] += 512;
+ if (state.t32[0] == 0)
+ state.t32[1]++;
+
+ compress32(state.data32);
+ databitlen -= (fill << 3);
+
+ left = 0;
+ }
+
+ /* compress data until enough for a block */
+ while( databitlen >= 512 ) {
+
+ /* update counter */
+ state.t32[0] += 512;
+
+ if (state.t32[0] == 0)
+ state.t32[1]++;
+ compress32(data);
+ databitlen -= 512;
+ }
+
+ if( databitlen > 0 ) {
+ System.arraycopy(data, 0, state.data32, (int)(left), (int)databitlen>>3);
+ state.datalen = (left<<3) + (int)databitlen;
+ /* when non-8-multiple, add remaining bits (1 to 7)*/
+ if ( (databitlen & 0x7) != 0)
+ state.data32[(int) ((int)(left) + (databitlen>>3))] = data[(int) (databitlen>>3)];
+ }
+ else
+ state.datalen=0;
+
+
+ return SUCCESS;
+ }
+
+ private int Update64(byte[] data, long databitlen ) {
+
+
+ long fill;
+ long left;
+
+ if ( ( databitlen == 0 ) && (state.datalen != 1024 ) )
+ return SUCCESS;
+
+ left = (state.datalen >> 3);
+ fill = 128L - left;
+
+ /* compress remaining data filled with new bits */
+ if( left!= 0 && ( ((databitlen >> 3) & 0x7F) >= fill ) ) {
+
+ System.arraycopy(data, 0, state.data64, (int)left,(int)fill);
+ /* update counter */
+ state.t64[0] += 1024;
+
+ compress64(state.data64);
+
+ databitlen -= (fill << 3);
+
+ left = 0;
+ }
+
+ /* compress data until enough for a block */
+ while( databitlen >= 1024 ) {
+
+ /* update counter */
+ state.t64[0] += 1024;
+ compress64(data);
+ databitlen -= 1024;
+ }
+
+ if( databitlen > 0 ) {
+ System.arraycopy(data, 0, state.data64, (int)left, (int)(databitlen>>3) & 0x7F);
+ state.datalen = (int) ((left<<3) + databitlen);
+
+ /* when non-8-multiple, add remaining bits (1 to 7)*/
+ if ( (databitlen & 0x7) !=0 )
+ state.data64[(int) (left + (databitlen>>3))] = data[(int) (databitlen>>3)];
+ }
+ else
+ state.datalen=0;
+
+ return SUCCESS;
+ }
+
+ private int Update(byte[] data, int databitlen) {
+
+ if ( state.hashbitlen < 384 )
+ return Update32(data, databitlen );
+ else
+ return Update64(data, databitlen);
+ }
+
+ private int Final32() {
+ byte msglen[] = new byte [8];
+ byte[] zz={(byte)0x00};
+ byte[] zo={(byte)0x01};
+ byte[] oz={(byte)0x80};
+ byte[] oo={(byte)0x81};
+
+ /*
+ copy nb. bits hash in total as a 64-bit BE word
+ */
+ long low, high;
+ low = state.t32[0] + state.datalen;
+ high = state.t32[1];
+ if ( low < state.datalen )
+ high++;
+ byte[] msglen0 = U32TO8_BE((int)high);
+ byte[] msglen1 = U32TO8_BE((int)low);
+ ByteBuffer msg = ByteBuffer.wrap(msglen);
+ msg.put(msglen0);
+ msg.put(msglen1);
+
+ if ( state.datalen % 8 == 0) {
+ /* message bitlength multiple of 8 */
+
+ if ( state.datalen == 440 ) {
+ /* special case of one padding short */
+ state.t32[0] -= 8;
+ if ( state.hashbitlen == 224 )
+ Update32(oz, 8 );
+ else
+ Update32(oo, 8 );
+ }
+ else {
+ if ( state.datalen < 440 ) {
+ /* use t=0 if no remaining data */
+ if ( state.datalen == 0 )
+ state.nullt=1;
+ /* enough space to fill the block */
+ state.t32[0] -= 440 - state.datalen;
+ Update32(padding, 440 - state.datalen );
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t32[0] -= 512 - state.datalen;
+ Update32(padding, 512 - state.datalen );
+ state.t32[0] -= 440;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 440 ); /* padd with zeroes */
+ state.nullt = 1; /* raise flag to set t=0 at the next compress */
+ }
+ if ( state.hashbitlen == 224 )
+ Update32(zz, 8 );
+ else
+ Update32(zo, 8 );
+ state.t32[0] -= 8;
+ }
+ state.t32[0] -= 64;
+ Update32(msglen, 64L );
+ }
+ else {
+ /* message bitlength NOT multiple of 8 */
+
+ /* add '1' */
+ state.data32[(int) (state.datalen/8)] &= (0xFF << (8-state.datalen%8));
+ state.data32[(int) (state.datalen/8)] ^= (0x80 >> (state.datalen%8));
+
+ if (( state.datalen > 440 ) && ( state.datalen < 447 )) {
+ /* special case of one padding short */
+ if ( state.hashbitlen == 224 )
+ state.data32[(int) (state.datalen/8)] ^= 0x00;
+ else
+ state.data32[(int) (state.datalen/8)] ^= 0x01;
+ state.t32[0] -= (8 - (state.datalen%8));
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ }
+ else {
+ if (state.datalen < 440) {
+ /* enough space to fill the block */
+ state.t32[0] -= 440 - state.datalen;
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update(Arrays.copyOfRange(padding,1,padding.length), (int)(440 - state.datalen) );
+ }
+ else {
+ if (state.datalen > 504 ) {
+ /* special case */
+ state.t32[0] -= 512 - state.datalen;
+ state.datalen=512;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 0 );
+ state.t32[0] -= 440;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 440 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t32[0] -= 512 - state.datalen;
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 512 - state.datalen );
+ state.t32[0] -= 440;
+ Update32(Arrays.copyOfRange(padding,1,padding.length), 440 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ }
+ state.t32[0] -= 8;
+ if ( state.hashbitlen == 224 )
+ Update32(zz, 8 );
+ else
+ Update32(zo, 8 );
+ }
+ state.t32[0] -= 64;
+ Update32(msglen, 64L );
+ }
+
+ byte[] hashval0 = U32TO8_BE(state.h32[0]);
+ byte[] hashval1 = U32TO8_BE(state.h32[1]);
+ byte[] hashval2 = U32TO8_BE(state.h32[2]);
+ byte[] hashval3 = U32TO8_BE(state.h32[3]);
+ byte[] hashval4 = U32TO8_BE(state.h32[4]);
+ byte[] hashval5 = U32TO8_BE(state.h32[5]);
+ byte[] hashval6 = U32TO8_BE(state.h32[6]);
+
+ ByteBuffer target = ByteBuffer.wrap(hashval);
+ target.put(hashval0);
+ target.put(hashval1);
+ target.put(hashval2);
+ target.put(hashval3);
+ target.put(hashval4);
+ target.put(hashval5);
+ target.put(hashval6);
+
+ if ( state.hashbitlen == 256 ) {
+ byte[] hashval7 = U32TO8_BE(state.h32[7]);
+ target.put(hashval7);
+ }
+
+ StringBuilder tb = new StringBuilder();
+ return SUCCESS;
+ }
+
+ private int Final64() {
+
+
+ byte msglen[] = new byte [16];
+ byte[] zz={(byte)0x00};
+ byte[] zo={(byte)0x01};
+ byte[] oz={(byte)0x80};
+ byte[] oo={(byte)0x81};
+
+ /* copy nb. bits hash in total as a 128-bit BE word */
+ long low, high;
+ low = state.t64[0] + state.datalen;
+ high = state.t64[1];
+ if ( low < state.datalen )
+ high = high + 1;
+ byte[] msglen0 = U64TO8_BE(high);
+ byte[] msglen1 = U64TO8_BE(low);
+ ByteBuffer msg = ByteBuffer.wrap(msglen);
+ msg.put(msglen0);
+ msg.put(msglen1);
+
+ if ( state.datalen % 8 == 0) {
+ /* message bitlength multiple of 8 */
+
+ if ( state.datalen == 888 ) {
+ /* special case of one padding short */
+ state.t64[0] -= 8;
+ if ( state.hashbitlen == 384 )
+ Update64(oz, 8 );
+ else
+ Update64(oo, 8 );
+ }
+ else {
+ if ( state.datalen < 888 ) {
+ /* use t=0 if no remaining data */
+ if ( state.datalen == 0 )
+ state.nullt=1;
+ /* enough space to fill the block */
+ state.t64[0] -= 888 - state.datalen;
+ Update64(padding, 888 - state.datalen );
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t64[0] -= 1024 - state.datalen;
+ Update64(padding, 1024 - state.datalen );
+ state.t64[0] -= 888;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 ); /* padd with zeros */
+ state.nullt = 1; /* raise flag to set t=0 at the next compress */
+ }
+ if ( state.hashbitlen == 384 )
+ Update64(zz, 8 );
+ else
+ Update(zo, 8 );
+ state.t64[0] -= 8;
+ }
+ state.t64[0] -= 128;
+ Update(msglen, 128 );
+ }
+ else {
+ /* message bitlength NOT multiple of 8 */
+
+ /* add '1' */
+ state.data64[(int) (state.datalen/8)] &= (0xFF << (8-state.datalen%8));
+ state.data64[(int) (state.datalen/8)] ^= (0x80 >> (state.datalen%8));
+
+ if (( state.datalen > 888 ) && ( state.datalen < 895 )) {
+ /* special case of one padding short */
+ if ( state.hashbitlen == 384 )
+ state.data64[(int) (state.datalen/8)] ^= 0x00;
+ else
+ state.data64[(int) (state.datalen/8)] ^= 0x01;
+ state.t64[0] -= (8 - (state.datalen%8));
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ }
+ else {
+ if (state.datalen < 888) {
+ /* enough space to fill the block */
+ state.t64[0] -= 888 - state.datalen;
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 - state.datalen );
+ }
+ else {
+ if (state.datalen > 1016 ) {
+ /* special case */
+ state.t64[0] -= 1024 - state.datalen;
+ state.datalen=1024;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 0 );
+ state.t64[0] -= 888;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ else {
+ /* NOT enough space, need 2 compressions */
+ state.t64[0] -= 1024 - state.datalen;
+ /* set datalen to a 8 multiple */
+ state.datalen = (state.datalen&0xfffffffffffffff8L)+8;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 1024 - state.datalen );
+ state.t64[0] -= 888;
+ Update64(Arrays.copyOfRange(padding,1,padding.length), 888 );
+ state.nullt = 1; /* raise flag for t=0 at the next compress */
+ }
+ }
+ state.t64[0] -= 8;
+ if ( state.hashbitlen == 384 )
+ Update64(zz, 8 );
+ else
+ Update64(zo, 8 );
+ }
+ state.t64[0] -= 128;
+ Update(msglen, 128 );
+ }
+
+ byte[] hashval0 = U64TO8_BE(state.h64[0]);
+ byte[] hashval1 = U64TO8_BE(state.h64[1]);
+ byte[] hashval2 = U64TO8_BE(state.h64[2]);
+ byte[] hashval3 = U64TO8_BE(state.h64[3]);
+ byte[] hashval4 = U64TO8_BE(state.h64[4]);
+ byte[] hashval5 = U64TO8_BE(state.h64[5]);
+
+ ByteBuffer target = ByteBuffer.wrap(hashval);
+ target.put(hashval0);
+ target.put(hashval1);
+ target.put(hashval2);
+ target.put(hashval3);
+ target.put(hashval4);
+ target.put(hashval5);
+
+ if ( state.hashbitlen == 512 ) {
+ byte[] hashval6 = U64TO8_BE(state.h64[6]);
+ byte[] hashval7 = U64TO8_BE(state.h64[7]);
+ target.put(hashval6);
+ target.put(hashval7);
+ }
+
+ return SUCCESS;
+ }
+
+ private int Final(){
+ if (state.hashbitlen < 384 )
+ return Final32();
+ else
+ return Final64();
+ }
+
+ private int Hash(int hashbitlen,byte[] data, int databitlen){
+ int ret;
+ ret = Init(hashbitlen);
+ if ( ret != SUCCESS ){
+ return ret;
+ }
+
+ ret = Update(data, databitlen);
+ if ( ret != SUCCESS ){
+ return ret;
+ }
+
+ ret = Final();
+ return ret;
+ }
+
+ private static int U8TO32_BE(byte[] p){
+ int q = java.nio.ByteBuffer.wrap(p).getInt();
+ return q; }
+ private static long U8TO64_BE(byte[] p){
+ int int1 = U8TO32_BE(Arrays.copyOfRange(p,0,4));
+ int int2 = U8TO32_BE(Arrays.copyOfRange(p,4,8));
+ long q = (((long)int1) << 32) | ((long)int2 & 0xffffffffL);
+ return q;
+ }
+ private static byte[] U32TO8_BE(int v){
+ ByteBuffer b = ByteBuffer.allocate(4);
+ b.putInt(v);
+ byte[] p = b.array();
+ return p;
+ }
+
+ private static byte[] U64TO8_BE(long v){
+ byte [] p1=U32TO8_BE((int)((v) >> 32));
+ byte [] p2=U32TO8_BE((int)((v)));
+ byte [] p3=new byte[8];
+ for(int i=0; i<4; i++) {
+ Arrays.fill(p3, i, i+1, p1[i]);
+ Arrays.fill(p3, i+4, i+5, p2[i]);
+ }
+ return p3;
+ }
+ private byte[] hexStrToByteField(String hexStr){
+ if(hexStr.length()%2==0){
+ byte [] bytes = new byte[hexStr.length()/2];
+ int i,j;
+
+ try{
+ for(i=0,j=0;j>5))+ Integer.toHexString((int)(c32[i])));
+ }
+
+ IV_panel = new Group(tabpage, SWT.SHADOW_IN);
+ IV_panel.setBounds(120, 430, 410, 110);
+ create_4X2_matrix(IV_panel, "IV", IV8_index, IV8_value);
+ for(int i=0; i<8; i++){
+ IV8_value[i].setText("0x"+ Integer.toHexString(IV224[i]));
+ }
+
+ s_panel = new Group(tabpage, SWT.SHADOW_IN);
+ s_panel.setBounds(120, 550, 410, 55);
+ create_4X1_matrix(s_panel, "s", s4_index, s4_value);
+}
+
+ public void create_4X1_matrix(Group s_panel, String name, Label s4_index[], Text s4_value[]){
+ for(int k=0; k<4; k++){
+ s4_index[k] = new Label(s_panel, SWT.NONE);
+ s4_index[k].setBounds(5+100*k, 5, 100, 25);
+ s4_index[k].setText(name+k);
+ s4_value[k] = new Text(s_panel, SWT.BORDER);
+ s4_value[k].setBounds(5+100*k, 30, 100, 25);
+ }
+ }
+
+ public void create_4X2_matrix(Group IV_panel, String name, Label IV8_index[], Text IV8_value[]){
+ for(int k=0; k<4; k++){
+ IV8_index[k] = new Label(IV_panel, SWT.NONE);
+ IV8_index[k].setBounds(5+100*k, 5, 100, 25);
+ IV8_index[k].setText(name+k);
+ IV8_value[k] = new Text(IV_panel, SWT.BORDER);
+ IV8_value[k].setBounds(5+100*k, 30, 100, 25);
+ IV8_index[k+4] = new Label(IV_panel, SWT.NONE);
+ IV8_index[k+4].setBounds(5+100*k, 55, 100, 25);
+ IV8_index[k+4].setText(name+k+4);
+ IV8_value[k+4] = new Text(IV_panel, SWT.BORDER);
+ IV8_value[k+4].setBounds(5+100*k, 80, 100, 25);
+ }
+
+ }
+ public void create_4X4_matrix(Group c_panel, String name, Label c16_index[], Text c16_value[]){
+ for(int i=0; i<4; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+150*i, 5, 150, 25);
+ c16_index[i].setText(name+i);
+ }
+ for(int i=0; i<4; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER);
+ c16_value[i].setBounds(5+150*i, 30, 150, 25);
+ }
+ for(int i=4; i<8; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+150*(i-c16_index.length/4), 55, 150, 25);
+ c16_index[i].setText(name+i);
+ }
+ for(int i=4; i<8; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER);
+ c16_value[i].setBounds(5+150*(i-4), 80, 150, 25);
+ }
+ for(int i=8; i<12; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+150*(i-8), 105, 150, 25);
+ c16_index[i].setText(name+i);
+ }
+ for(int i=8; i<12; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER);
+ c16_value[i].setBounds(5+150*(i-8), 130, 150, 25);
+ }
+ for(int i=12; i<16; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+150*(i-12), 155, 150, 25);
+ c16_index[i].setText(name+i);
+ }
+ for(int i=12; i<16; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER);
+ c16_value[i].setBounds(5+150*(i-12), 180, 150, 25);
+ }
+ }
+
+ public void create_m(Blake_Action BLAKE, String inputText, String saltText){
+ BLAKE224=BLAKE;
+ c16_index[1].setText("lol");
+ c16_value[1].setText("lol");
+// String mHexValue = new String(Hex.encode(BLAKE224.Algorithm.state.data32));
+// m16_value[0].setText("0x"+mHexValue);
+
+// if(saltText.length()==32){
+// for(int i=0; i<8; i++){
+// s4_value[i].setText("0x"+ Integer.toHexString(BLAKE224.Algorithm.state.salt32[i]));
+// }
+// }
+
+ }
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0.java
new file mode 100755
index 0000000..f4635f9
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab0.java
@@ -0,0 +1,368 @@
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.jcryptool.visual.sha3candidates.views.Messages;
+
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.c32;
+
+
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+
+
+public class Blake_tab0 {
+ public Table table;
+ public Table table1;
+ public Browser Hashpage;
+ public String hashName="BLAKE224", inputText=null, saltText=null;
+ public HashFunction hash=null;
+ public byte[] digest=null;
+ public TableItem item[];
+ public TabFolder tabFolder;
+ public Group m_panel;
+ public Label m16_index[]=new Label[16];
+ public Text m16_value[]=new Text[16];
+ public Group s_panel;
+ public Label s4_index[]=new Label[4];;
+ public Text s4_value[]=new Text[4];;
+ public TabItem tabItem;
+ public Group tabpage;
+ public Group h_panel;
+ public Label h8_index[]=new Label[8];;
+ public Text h8_value[]=new Text[8];;
+ public Group c_panel;
+ public Label c16_index[]=new Label[16];;
+ public Text c16_value[]=new Text[16];
+ public Group t_panel;
+ public Label t2_index[]=new Label[2];
+ public Text t2_value[]=new Text[2];
+ public GC gc;
+ public Blake_Action BLAKE224;
+ public GridLayout grid;
+ public Group v0_panel;
+ public Group v_panel;
+ public Label v_label;
+ public Canvas v_canvas;
+ public Image v_image;
+ public Label v16_index[]=new Label[16];
+ public Text v16_value[]=new Text[16];
+ public StyledText tutorial_text;
+ public Button message1, message2, message3;
+ public Button MessageButton, SaltButton;
+ public Blake_tab0(TabFolder tabFolder_input, Group tabpage_input){
+ tabFolder=tabFolder_input;
+ tabpage=tabpage_input;
+ create_tab0();
+ }
+
+ public void create_tab0(){
+ message1=new Button(tabpage, SWT.BORDER);
+ message1.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message1.setBackground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message2=new Button(tabpage, SWT.BORDER);
+ message2.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message2.setBackground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message3=new Button(tabpage, SWT.BORDER);
+ message3.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message3.setBackground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+
+
+// Hashpage = new Browser(tabpage, SWT.BORDER);
+// Hashpage.setBounds(800, 130, 300, 300);
+// Hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ gc = new GC(tabpage);
+ gc.setLineWidth(4);
+ tabpage.addPaintListener(new PaintListener(){
+ public void paintControl(PaintEvent e){
+ e.gc.setLineWidth(4);
+ e.gc.drawLine(0,325,50,325);
+ e.gc.drawLine(50,325,50,100);
+ e.gc.drawLine(0,645,20,645);
+ }
+ });
+
+ MessageButton = new Button(tabpage, SWT.NONE);
+ MessageButton.setText("Messaage");
+ MessageButton.setBounds(20, 75, 80, 50);
+ MessageButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(50,100,120,100);
+ gc.drawLine(115,95,120,100);
+ gc.drawLine(115,105,120,100);
+
+ gc.drawLine(730,100,780,100);
+ gc.drawLine(780,100,775,95);
+ gc.drawLine(780,100,775,105);
+
+ gc.drawLine(220,220,220,235);
+ gc.drawLine(215,230,220,235);
+ gc.drawLine(225,230,220,235);
+ message1.setText("click to continue");
+ message1.setBounds(880, 200, 420, 30);
+
+ String mHexValue = new String(Hex.encode(BLAKE224.Algorithm.state.data32));
+ m16_value[0].setText("0x"+mHexValue);
+ t2_value[0].setText("0x"+Integer.toHexString(BLAKE224.Algorithm.state.t32[0]));
+ t2_value[1].setText("0x"+Integer.toHexString(BLAKE224.Algorithm.state.t32[1]));
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ SaltButton = new Button(tabpage, SWT.NONE);
+ SaltButton.setText("Salt");
+ SaltButton.setBounds(20, 620, 80, 50);
+ SaltButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(100, 645, 120, 645);
+ gc.drawLine(115, 640, 120, 645);
+ gc.drawLine(115, 650, 120, 645);
+ for(int i=0; i<8; i++){
+ s4_value[i].setText("0x"+ Integer.toHexString(BLAKE224.Algorithm.state.salt32[i]));
+ }
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ tutorial_text=new StyledText(tabpage, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
+ tutorial_text.setBounds(120, 10, 610, 210);
+ tutorial_text.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ tutorial_text.setSelection(0, 0);
+ }
+ });
+ tutorial_text.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ tutorial_text.selectAll();
+ }
+ }
+ });
+ tutorial_text.setEditable(false);
+ tutorial_text.setFont(SWTResourceManager.getFont("Segoe UI", 11, SWT.ITALIC));
+ tutorial_text.setText("BLAKE224/256\n"+ Messages.HashingView_01);
+
+
+ m_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ m_panel.setBounds(780, 10, 620, 180);
+ create_4X4_matrix(m_panel, "m", m16_index, m16_value, 20, 150);
+
+ t_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ t_panel.setBounds(120, 235, 210, 60);
+ create_2X1_matrix(t_panel, "t", t2_index, t2_value, 20, 100);
+
+ c_panel = new Group(tabpage,SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ c_panel.setBounds(120, 305, 620, 180);
+ create_4X4_matrix(c_panel, "c", c16_index, c16_value, 20, 150);
+ for(int i=0; i<16; i++){
+ c16_value[i].setText("0x"+ Integer.toHexString((int)(c32[i]>>5))+ Integer.toHexString((int)(c32[i])));
+ }
+
+ h_panel = new Group(tabpage, SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ h_panel.setBounds(120, 500, 420, 100);
+ create_4X2_matrix(h_panel, "h", h8_index, h8_value, 20, 100);
+ for(int i=0; i<8; i++){
+ h8_value[i].setText("0x"+ Integer.toHexString(IV224[i]));
+ }
+
+ s_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ s_panel.setBounds(120, 615, 420, 60);
+ create_4X1_matrix(s_panel, "s", s4_index, s4_value, 20, 100);
+
+ v0_panel=new Group(tabpage, SWT.BORDER| SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ v0_panel.setBounds(880, 235, 420, 180);
+ create_4X4_matrix(v0_panel,"v", v16_index, v16_value, 20, 100);
+ for(int i=0;i<8;i++){
+ v16_value[i].setText("h"+i);
+ }
+ for(int i=0;i<4;i++){
+ v16_value[i+8].setText("s"+i+" XOR c"+i);
+ }
+ v16_value[12].setText("t0 XOR c4");
+ v16_value[13].setText("t0 XOR c5");
+ v16_value[14].setText("t1 XOR c6");
+ v16_value[15].setText("t1 XOR c7");
+ message1.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(325, 260, 880, 260);
+ gc.drawLine(875, 255, 880, 260);
+ gc.drawLine(875, 265, 880, 260);
+
+ gc.drawLine(730, 320, 880, 320);
+ gc.drawLine(875, 325, 880, 320);
+ gc.drawLine(875, 315, 880, 320);
+
+ gc.drawLine(530, 550, 745, 550);
+ gc.drawLine(745, 550, 745, 350);
+ gc.drawLine(745, 350, 880, 350);
+ gc.drawLine(875, 345, 880, 350);
+ gc.drawLine(875, 355, 880, 350);
+
+ gc.drawLine(530, 645, 765, 645);
+ gc.drawLine(765, 645, 765, 380);
+ gc.drawLine(765, 380, 880, 380);
+ gc.drawLine(875, 385, 880, 380);
+ gc.drawLine(875, 375, 880, 380);
+
+ message2.setText("click to continue");
+ message2.setBounds(1080, 440, 300, 30);
+ message1.setBounds(1080, 440, 0, 0);
+ }
+ });
+
+ v_panel=new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ v_panel.setBounds(780, 500, 620, 180);
+ message2.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(1000, 415, 1000, 500);
+ gc.drawLine(995, 495, 1000, 500);
+ gc.drawLine(1005, 495, 1000, 500);
+ message3.setText("click to continue");
+ message3.setBounds(780, 680, 620, 30);
+ message2.setBounds(1080, 440, 0, 0);
+ for(int i=0;i<8;i++){
+ v16_value[i].setText("0x"+(IV224[i]&0xffffffffL));
+ }
+ for(int i=0;i<4;i++){
+ v16_value[8+i].setText("0x"+((BLAKE224.Algorithm.state.salt32[i]^c32[i])& 0xffffffffL));
+ }
+ v16_value[12].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[4]) & 0xffffffffL));
+ v16_value[13].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[5]) & 0xffffffffL));
+ v16_value[14].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[6]) & 0xffffffffL));
+ v16_value[15].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[7]) & 0xffffffffL));
+
+ }
+ });
+ create_4X4_matrix(v_panel,"v", v16_index, v16_value, 20, 150);
+
+
+}
+
+ public void create_2X1_matrix(Group t_panel, String name, Label t2_index[], Text t2_value[], int height, int width){
+ for(int k=0; k<2; k++){
+ t2_index[k] = new Label(t_panel, SWT.NONE);
+ t2_index[k].setBounds(5+width*k, 5, width, height);
+ t2_index[k].setAlignment(SWT.CENTER);
+ t2_index[k].setText(name+k);
+ t2_value[k] = new Text(t_panel, SWT.BORDER|SWT.CENTER);
+ t2_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X1_matrix(Group s_panel, String name, Label s4_index[], Text s4_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ s4_index[k] = new Label(s_panel, SWT.NONE);
+ s4_index[k].setBounds(5+width*k, 5, width, height);
+ s4_index[k].setText(name+k);
+ s4_index[k].setAlignment(SWT.CENTER);
+ s4_value[k] = new Text(s_panel, SWT.BORDER|SWT.CENTER);
+ s4_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X2_matrix(Group h_panel, String name, Label h8_index[], Text h8_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*k, 5, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ for(int k=4; k<8; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*(k-4), 5+height*2, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*(k-4), 5+height*3, width, height);
+ }
+
+ }
+ public void create_4X4_matrix(Group c_panel, String name, Label c16_index[], Text c16_value[], int height, int width){
+ for(int i=0; i<4; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*i, 5, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=0; i<4; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER | SWT.CENTER);
+ c16_value[i].setBounds(5+width*i, 5+height, width, height);
+ }
+ for(int i=4; i<8; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-4), 5+2*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=4; i<8; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-4), 5+3*height, width, height);
+ }
+ for(int i=8; i<12; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-8), 5+4*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=8; i<12; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-8), 5+5*height, width, height);
+ }
+ for(int i=12; i<16; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-12), 5+6*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=12; i<16; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-12), 5+7*height, width, height);
+ }
+ }
+
+ public void create_m(Blake_Action BLAKE, String inputText, String saltText){
+ BLAKE224=BLAKE;
+ }
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00.java
new file mode 100755
index 0000000..c450ddb
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab00.java
@@ -0,0 +1,368 @@
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.jcryptool.visual.sha3candidates.views.Messages;
+
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.c32;
+
+
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+
+
+public class Blake_tab00 {
+ public Table table;
+ public Table table1;
+ public Browser Hashpage;
+ public String hashName="BLAKE224", inputText=null, saltText=null;
+ public HashFunction hash=null;
+ public byte[] digest=null;
+ public TableItem item[];
+ public TabFolder tabFolder;
+ public Group m_panel;
+ public Label m16_index[]=new Label[16];
+ public Text m16_value[]=new Text[16];
+ public Group s_panel;
+ public Label s4_index[]=new Label[4];;
+ public Text s4_value[]=new Text[4];;
+ public TabItem tabItem;
+ public Group tabpage;
+ public Group h_panel;
+ public Label h8_index[]=new Label[8];;
+ public Text h8_value[]=new Text[8];;
+ public Group c_panel;
+ public Label c16_index[]=new Label[16];;
+ public Text c16_value[]=new Text[16];
+ public Group t_panel;
+ public Label t2_index[]=new Label[2];
+ public Text t2_value[]=new Text[2];
+ public GC gc;
+ public Blake_Action BLAKE224;
+ public GridLayout grid;
+ public Group v0_panel;
+ public Group v_panel;
+ public Label v_label;
+ public Canvas v_canvas;
+ public Image v_image;
+ public Label v16_index[]=new Label[16];
+ public Text v16_value[]=new Text[16];
+ public StyledText tutorial_text;
+ public Button message1, message2, message3;
+ public Button MessageButton, SaltButton;
+ public Blake_tab00(TabFolder tabFolder_input, Group tabpage_input){
+ tabFolder=tabFolder_input;
+ tabpage=tabpage_input;
+ create_tab0();
+ }
+
+ public void create_tab0(){
+ message1=new Button(tabpage, SWT.BORDER);
+ message1.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message1.setBackground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message2=new Button(tabpage, SWT.BORDER);
+ message2.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message2.setBackground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message3=new Button(tabpage, SWT.BORDER);
+ message3.setForeground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+ message3.setBackground(SWTResourceManager.getColor(SWT.COLOR_LINK_FOREGROUND));
+
+
+// Hashpage = new Browser(tabpage, SWT.BORDER);
+// Hashpage.setBounds(800, 130, 300, 300);
+// Hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ gc = new GC(tabpage);
+ gc.setLineWidth(4);
+ tabpage.addPaintListener(new PaintListener(){
+ public void paintControl(PaintEvent e){
+ e.gc.setLineWidth(4);
+ e.gc.drawLine(0,325,50,325);
+ e.gc.drawLine(50,325,50,100);
+ e.gc.drawLine(0,645,20,645);
+ }
+ });
+
+ MessageButton = new Button(tabpage, SWT.NONE);
+ MessageButton.setText("Messaage");
+ MessageButton.setBounds(20, 75, 80, 50);
+ MessageButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(50,100,120,100);
+ gc.drawLine(115,95,120,100);
+ gc.drawLine(115,105,120,100);
+
+ gc.drawLine(730,100,780,100);
+ gc.drawLine(780,100,775,95);
+ gc.drawLine(780,100,775,105);
+
+ gc.drawLine(220,220,220,235);
+ gc.drawLine(215,230,220,235);
+ gc.drawLine(225,230,220,235);
+ message1.setText("Double click to continue");
+ message1.setBounds(880, 200, 420, 30);
+
+ String mHexValue = new String(Hex.encode(BLAKE224.Algorithm.state.data32));
+ m16_value[0].setText("0x"+mHexValue);
+ t2_value[0].setText("0x"+Integer.toHexString(BLAKE224.Algorithm.state.t32[0]));
+ t2_value[1].setText("0x"+Integer.toHexString(BLAKE224.Algorithm.state.t32[1]));
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ SaltButton = new Button(tabpage, SWT.NONE);
+ SaltButton.setText("Salt");
+ SaltButton.setBounds(20, 620, 80, 50);
+ SaltButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(100, 645, 120, 645);
+ gc.drawLine(115, 640, 120, 645);
+ gc.drawLine(115, 650, 120, 645);
+ for(int i=0; i<8; i++){
+ s4_value[i].setText("0x"+ Integer.toHexString(BLAKE224.Algorithm.state.salt32[i]));
+ }
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ tutorial_text=new StyledText(tabpage, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
+ tutorial_text.setBounds(120, 10, 610, 210);
+ tutorial_text.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ tutorial_text.setSelection(0, 0);
+ }
+ });
+ tutorial_text.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ tutorial_text.selectAll();
+ }
+ }
+ });
+ tutorial_text.setEditable(false);
+ tutorial_text.setFont(SWTResourceManager.getFont("Segoe UI", 11, SWT.ITALIC));
+ tutorial_text.setText("BLAKE224/256\n"+ Messages.HashingView_01);
+
+
+ m_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ m_panel.setBounds(780, 10, 620, 180);
+ create_4X4_matrix(m_panel, "m", m16_index, m16_value, 20, 150);
+
+ t_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ t_panel.setBounds(120, 235, 210, 60);
+ create_2X1_matrix(t_panel, "t", t2_index, t2_value, 20, 100);
+
+ c_panel = new Group(tabpage,SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ c_panel.setBounds(120, 305, 620, 180);
+ create_4X4_matrix(c_panel, "c", c16_index, c16_value, 20, 150);
+ for(int i=0; i<16; i++){
+ c16_value[i].setText("0x"+ Integer.toHexString((int)(c32[i]>>5))+ Integer.toHexString((int)(c32[i])));
+ }
+
+ h_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ h_panel.setBounds(120, 500, 420, 100);
+ create_4X2_matrix(h_panel, "h", h8_index, h8_value, 20, 100);
+ for(int i=0; i<8; i++){
+ h8_value[i].setText("0x"+ Integer.toHexString(IV224[i]));
+ }
+
+ s_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ s_panel.setBounds(120, 615, 420, 60);
+ create_4X1_matrix(s_panel, "s", s4_index, s4_value, 20, 100);
+
+ v0_panel=new Group(tabpage, SWT.BORDER| SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ v0_panel.setBounds(880, 235, 420, 180);
+ create_4X4_matrix(v0_panel,"v", v16_index, v16_value, 20, 100);
+ for(int i=0;i<8;i++){
+ v16_value[i].setText("h"+i);
+ }
+ for(int i=0;i<4;i++){
+ v16_value[i+8].setText("s"+i+" XOR c"+i);
+ }
+ v16_value[12].setText("t0 XOR c4");
+ v16_value[13].setText("t0 XOR c5");
+ v16_value[14].setText("t1 XOR c6");
+ v16_value[15].setText("t1 XOR c7");
+ message1.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(325, 260, 880, 260);
+ gc.drawLine(875, 255, 880, 260);
+ gc.drawLine(875, 265, 880, 260);
+
+ gc.drawLine(730, 320, 880, 320);
+ gc.drawLine(875, 325, 880, 320);
+ gc.drawLine(875, 315, 880, 320);
+
+ gc.drawLine(530, 550, 745, 550);
+ gc.drawLine(745, 550, 745, 350);
+ gc.drawLine(745, 350, 880, 350);
+ gc.drawLine(875, 345, 880, 350);
+ gc.drawLine(875, 355, 880, 350);
+
+ gc.drawLine(530, 645, 765, 645);
+ gc.drawLine(765, 645, 765, 380);
+ gc.drawLine(765, 380, 880, 380);
+ gc.drawLine(875, 385, 880, 380);
+ gc.drawLine(875, 375, 880, 380);
+
+ message2.setText("Double click to continue");
+ message2.setBounds(1080, 440, 300, 30);
+ message1.setBounds(1080, 440, 0, 0);
+ }
+ });
+
+ v_panel=new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ v_panel.setBounds(780, 500, 620, 180);
+ message2.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(1000, 415, 1000, 500);
+ gc.drawLine(995, 495, 1000, 500);
+ gc.drawLine(1005, 495, 1000, 500);
+ message3.setText("Double click to continue");
+ message3.setBounds(780, 680, 620, 30);
+ message2.setBounds(1080, 440, 0, 0);
+ for(int i=0;i<8;i++){
+ v16_value[i].setText("0x"+(IV224[i]&0xffffffffL));
+ }
+ for(int i=0;i<4;i++){
+ v16_value[8+i].setText("0x"+((BLAKE224.Algorithm.state.salt32[i]^c32[i])& 0xffffffffL));
+ }
+ v16_value[12].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[4]) & 0xffffffffL));
+ v16_value[13].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[5]) & 0xffffffffL));
+ v16_value[14].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[6]) & 0xffffffffL));
+ v16_value[15].setText("0x"+((BLAKE224.Algorithm.state.t32[0] ^ c32[7]) & 0xffffffffL));
+
+ }
+ });
+ create_4X4_matrix(v_panel,"v", v16_index, v16_value, 20, 150);
+
+
+}
+
+ public void create_2X1_matrix(Group t_panel, String name, Label t2_index[], Text t2_value[], int height, int width){
+ for(int k=0; k<2; k++){
+ t2_index[k] = new Label(t_panel, SWT.NONE);
+ t2_index[k].setBounds(5+width*k, 5, width, height);
+ t2_index[k].setAlignment(SWT.CENTER);
+ t2_index[k].setText(name+k);
+ t2_value[k] = new Text(t_panel, SWT.BORDER|SWT.CENTER);
+ t2_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X1_matrix(Group s_panel, String name, Label s4_index[], Text s4_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ s4_index[k] = new Label(s_panel, SWT.NONE);
+ s4_index[k].setBounds(5+width*k, 5, width, height);
+ s4_index[k].setText(name+k);
+ s4_index[k].setAlignment(SWT.CENTER);
+ s4_value[k] = new Text(s_panel, SWT.BORDER|SWT.CENTER);
+ s4_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X2_matrix(Group h_panel, String name, Label h8_index[], Text h8_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*k, 5, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ for(int k=4; k<8; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*(k-4), 5+height*2, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*(k-4), 5+height*3, width, height);
+ }
+
+ }
+ public void create_4X4_matrix(Group c_panel, String name, Label c16_index[], Text c16_value[], int height, int width){
+ for(int i=0; i<4; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*i, 5, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=0; i<4; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER | SWT.CENTER);
+ c16_value[i].setBounds(5+width*i, 5+height, width, height);
+ }
+ for(int i=4; i<8; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-4), 5+2*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=4; i<8; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-4), 5+3*height, width, height);
+ }
+ for(int i=8; i<12; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-8), 5+4*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=8; i<12; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-8), 5+5*height, width, height);
+ }
+ for(int i=12; i<16; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-12), 5+6*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=12; i<16; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-12), 5+7*height, width, height);
+ }
+ }
+
+ public void create_m(Blake_Action BLAKE, String inputText, String saltText){
+ BLAKE224=BLAKE;
+ }
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1.java
new file mode 100755
index 0000000..a673418
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab1.java
@@ -0,0 +1,795 @@
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.jcryptool.visual.sha3candidates.views.Messages;
+
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.c32;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+
+public class Blake_tab1 {
+
+ public short sigma[][] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 }
+ };
+
+ public Table table;
+ public Table table1;
+ public Browser Hashpage;
+ public String hashName="BLAKE224", inputText=null, saltText=null;
+ public HashFunction hash=null;
+ public byte[] digest=null;
+ public TableItem item[];
+ public TabFolder tabFolder;
+ public Group m_panel;
+ public Label m16_index[]=new Label[16];
+ public Text m16_value[]=new Text[16];
+ public Group s_panel;
+ public Label s4_index[]=new Label[4];;
+ public Text s4_value[]=new Text[4];;
+ public TabItem tabItem;
+ public Group tabpage;
+ public Group h_panel;
+ public Label h8_index[]=new Label[8];;
+ public Text h8_value[]=new Text[8];;
+ public Group c_panel;
+ public Label c16_index[]=new Label[16];;
+ public Text c16_value[]=new Text[16];
+ public Group t_panel;
+ public Label t2_index[]=new Label[2];
+ public Text t2_value[]=new Text[2];
+ public GC gc;
+ public Blake_Action BLAKE224;
+ public GridLayout grid;
+ public Group v0_panel;
+ public Group v_panel;
+ public Label v_label;
+ public Canvas v_canvas;
+ public Image v_image;
+ public Label v16_index[]=new Label[16];
+ public long v16_initial[]=new long[16];
+ public long v16_input[]=new long[16];
+ public long v16_output[]=new long[16];
+ public StyledText tutorial_text;
+ public Button message1, message2, message3;
+ public Group g0_panel[]=new Group[8];
+ public Label g0_index[][]=new Label[8][4];
+ public Text g0_value[][]=new Text[8][4];
+ public Group g1_panel[]=new Group[8];
+ public Label g1_index[][]=new Label[8][4];
+ public Text g1_value[][]=new Text[8][4];
+ public Button calc[]=new Button[20];
+ public int round_num=0;
+ public byte datablock[]=new byte[64];
+ public long m_block[]=new long[16];
+ public long m1, c1, m2, c2;
+ public Button sigma_button;
+ public Label sigma_panel;
+ public Button SaltButton;
+ public long v16[]=new long[16];
+
+ public Blake_tab1(TabFolder tabFolder_input, Group tabpage_input){
+ tabFolder=tabFolder_input;
+ tabpage=tabpage_input;
+ create_tab0();
+ }
+
+ public void load(long v16[], byte[] input){
+ v16_initial=v16;
+ v16_input=v16;
+ for(int i=0; i>>12");
+
+ ////ba////
+ gc.drawLine(670,550,670,500);
+ gc.drawLine(660,520,670,500);
+ gc.drawLine(680,520,670,500);
+ calc[4]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[4].setBounds(650, 460, 40, 40);
+ calc[4].setAlignment(SWT.CENTER);
+ calc[4].setFont(SWTResourceManager.getFont("Segoe UI", 18, SWT.BOLD));
+ calc[4].setText("+");
+ calc[9]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[9].setAlignment(SWT.CENTER);
+ calc[9].setBounds(640, 670, 60, 40);
+ calc[9].setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
+ calc[9].setText(">>>16");
+
+
+ ////oa////
+ gc.drawLine(750,720,750,480);
+ gc.drawLine(740,500,750,480);
+ gc.drawLine(760,500,750,480);
+ calc[14]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[14].setAlignment(SWT.CENTER);
+ calc[14].setBounds(590, 720, 140, 40);
+ calc[14].setText("m");
+ calc[5]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[5].setAlignment(SWT.CENTER);
+ calc[5].setBounds(730, 720, 40, 40);
+ calc[5].setAlignment(SWT.CENTER);
+ calc[5].setFont(SWTResourceManager.getFont("Segoe UI", 18, SWT.BOLD));
+ calc[5].setText("+");
+ calc[15]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[15].setAlignment(SWT.CENTER);
+ calc[15].setBounds(770, 720, 140, 40);
+ calc[15].setText("c");
+ ////ad///
+ gc.drawLine(835,480,835,670);
+ gc.drawLine(830,650,835,670);
+ gc.drawLine(840,650,835,670);
+ calc[6]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[6].setBounds(815, 670, 40, 40);
+ calc[6].setAlignment(SWT.CENTER);
+ calc[6].setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
+ calc[6].setText("XOR");
+
+ calc[10]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[10].setAlignment(SWT.CENTER);
+ calc[10].setBounds(945, 460, 60, 40);
+ calc[10].setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
+ calc[10].setText(">>>7");
+
+ calc[7]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[7].setAlignment(SWT.CENTER);
+ calc[7].setBounds(965, 530, 40, 40);
+ calc[7].setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
+ calc[7].setText("XOR");
+
+ calc[11]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[11].setAlignment(SWT.CENTER);
+ calc[11].setBounds(945, 670, 60, 40);
+ calc[11].setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
+ calc[11].setText(">>>8");
+
+ calc[16]=new Button(tabpage, SWT.NONE|SWT.ON_TOP);
+ calc[16].setAlignment(SWT.CENTER);
+ calc[16].setBounds(1115,600,40,40);
+ calc[16].setFont(SWTResourceManager.getFont("Segoe UI", 18, SWT.BOLD));
+ calc[16].setText("+");
+
+ ////cb////
+ gc.drawLine(1135,550,1005,550);
+ gc.drawLine(1025,560,1005,550);
+ gc.drawLine(1025,540,1005,550);
+
+ ////dc///
+ gc.drawLine(1135,690,1135,640);
+ gc.drawLine(1125,660,1135,640);
+ gc.drawLine(1145,660,1135,640);
+
+ for(int i=0; i<8; i++){
+ gc.setLineWidth(4);
+ gc.setLineStyle(SWT.LINE_DASHDOT);
+ gc.drawLine(670, 40+50*i, 750, 40+50*i);
+ gc.drawLine(740, 40+50*i-10, 750, 40+50*i);
+ gc.drawLine(740, 40+50*i+10, 750, 40+50*i);
+
+ }
+ gc.setLineStyle(SWT.LINE_SOLID);
+
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ sigma_button.setBounds(20, 620, 150, 50);
+ sigma_button.setText("sigma matrix");
+
+ SaltButton = new Button(tabpage, SWT.NONE);
+ SaltButton.setText("Round "+round_num);
+ SaltButton.setBounds(20, 520, 100, 50);
+ SaltButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+
+ gc.drawLine(70, 570, 70, 620);
+ gc.drawLine(25, 670, 25, 740);
+ gc.drawLine(25, 740, 50, 740);
+
+ g0_value[0][0].setText("0x"+v16_input[0]);
+ g0_value[0][1].setText("0x"+v16_input[4]);
+ g0_value[0][2].setText("0x"+v16_input[8]);
+ g0_value[0][3].setText("0x"+v16_input[12]);
+ g0_value[1][0].setText("0x"+v16_input[1]);
+ g0_value[1][1].setText("0x"+v16_input[5]);
+ g0_value[1][2].setText("0x"+v16_input[9]);
+ g0_value[1][3].setText("0x"+v16_input[13]);
+ g0_value[2][0].setText("0x"+v16_input[2]);
+ g0_value[2][1].setText("0x"+v16_input[6]);
+ g0_value[2][2].setText("0x"+v16_input[10]);
+ g0_value[2][3].setText("0x"+v16_input[14]);
+ g0_value[3][0].setText("0x"+v16_input[3]);
+ g0_value[3][1].setText("0x"+v16_input[7]);
+ g0_value[3][2].setText("0x"+v16_input[11]);
+ g0_value[3][3].setText("0x"+v16_input[15]);
+ g0_value[4][0].setText("0x"+v16_input[0]);
+ g0_value[4][1].setText("0x"+v16_input[5]);
+ g0_value[4][2].setText("0x"+v16_input[10]);
+ g0_value[4][3].setText("0x"+v16_input[15]);
+ g0_value[5][0].setText("0x"+v16_input[1]);
+ g0_value[5][1].setText("0x"+v16_input[6]);
+ g0_value[5][2].setText("0x"+v16_input[11]);
+ g0_value[5][3].setText("0x"+v16_input[12]);
+ g0_value[6][0].setText("0x"+v16_input[2]);
+ g0_value[6][1].setText("0x"+v16_input[7]);
+ g0_value[6][2].setText("0x"+v16_input[8]);
+ g0_value[6][3].setText("0x"+v16_input[13]);
+ g0_value[7][0].setText("0x"+v16_input[3]);
+ g0_value[7][1].setText("0x"+v16_input[4]);
+ g0_value[7][2].setText("0x"+v16_input[9]);
+ g0_value[7][3].setText("0x"+v16_input[14]);
+
+ v16_output=round(m_block, v16_initial, (short)round_num);
+ round_num++;
+ SaltButton.setText("Round "+round_num);
+ calc[12].setText("0x"+m1);
+ calc[13].setText("0x"+c1);
+ calc[14].setText("0x"+m2);
+ calc[15].setText("0x"+c2);
+
+
+ g1_value[0][0].setText("0x"+v16_output[0]);
+ g1_value[0][1].setText("0x"+v16_output[4]);
+ g1_value[0][2].setText("0x"+v16_output[8]);
+ g1_value[0][3].setText("0x"+v16_output[12]);
+ g1_value[1][0].setText("0x"+v16_output[1]);
+ g1_value[1][1].setText("0x"+v16_output[5]);
+ g1_value[1][2].setText("0x"+v16_output[9]);
+ g1_value[1][3].setText("0x"+v16_output[13]);
+ g1_value[2][0].setText("0x"+v16_output[2]);
+ g1_value[2][1].setText("0x"+v16_output[6]);
+ g1_value[2][2].setText("0x"+v16_output[10]);
+ g1_value[2][3].setText("0x"+v16_output[14]);
+ g1_value[3][0].setText("0x"+v16_output[3]);
+ g1_value[3][1].setText("0x"+v16_output[7]);
+ g1_value[3][2].setText("0x"+v16_output[11]);
+ g1_value[3][3].setText("0x"+v16_output[15]);
+ g1_value[4][0].setText("0x"+v16_output[0]);
+ g1_value[4][1].setText("0x"+v16_output[5]);
+ g1_value[4][2].setText("0x"+v16_output[10]);
+ g1_value[4][3].setText("0x"+v16_output[15]);
+ g1_value[5][0].setText("0x"+v16_output[1]);
+ g1_value[5][1].setText("0x"+v16_output[6]);
+ g1_value[5][2].setText("0x"+v16_output[11]);
+ g1_value[5][3].setText("0x"+v16_output[12]);
+ g1_value[6][0].setText("0x"+v16_output[2]);
+ g1_value[6][1].setText("0x"+v16_output[7]);
+ g1_value[6][2].setText("0x"+v16_output[8]);
+ g1_value[6][3].setText("0x"+v16_output[13]);
+ g1_value[7][0].setText("0x"+v16_output[3]);
+ g1_value[7][1].setText("0x"+v16_output[4]);
+ g1_value[7][2].setText("0x"+v16_output[9]);
+ g1_value[7][3].setText("0x"+v16_output[14]);
+
+ v16_input=v16_output;
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+
+
+
+
+}
+
+ public void create_2X1_matrix(Group t_panel, String name, Label t2_index[], Text t2_value[], int height, int width){
+ for(int k=0; k<2; k++){
+ t2_index[k] = new Label(t_panel, SWT.NONE);
+ t2_index[k].setBounds(5+width*k, 5, width, height);
+ t2_index[k].setAlignment(SWT.CENTER);
+ t2_index[k].setText(name+k);
+ t2_value[k] = new Text(t_panel, SWT.BORDER|SWT.CENTER);
+ t2_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X1_matrix(Group s_panel, String name, Label s4_index[], Text s4_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ s4_index[k] = new Label(s_panel, SWT.NONE);
+ s4_index[k].setBounds(5+width*k, 5, width, height);
+ s4_index[k].setText(name+k);
+ s4_index[k].setAlignment(SWT.CENTER);
+ s4_value[k] = new Text(s_panel, SWT.BORDER|SWT.CENTER);
+ s4_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X2_matrix(Group h_panel, String name, Label h8_index[], Text h8_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*k, 5, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ for(int k=4; k<8; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*(k-4), 5+height*2, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*(k-4), 5+height*3, width, height);
+ }
+
+ }
+ public void create_4X4_matrix(Group c_panel, String name, Label c16_index[], Text c16_value[], int height, int width){
+ for(int i=0; i<4; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*i, 5, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=0; i<4; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER | SWT.CENTER);
+ c16_value[i].setBounds(5+width*i, 5+height, width, height);
+ }
+ for(int i=4; i<8; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-4), 5+2*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=4; i<8; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-4), 5+3*height, width, height);
+ }
+ for(int i=8; i<12; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-8), 5+4*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=8; i<12; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-8), 5+5*height, width, height);
+ }
+ for(int i=12; i<16; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-12), 5+6*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=12; i<16; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-12), 5+7*height, width, height);
+ }
+ }
+
+ public void create_m(Blake_Action BLAKE, String inputText, String saltText){
+ BLAKE224=BLAKE;
+ }
+
+ public long[] compress32(byte[] datablock){
+
+ long m[] = new long[16];
+ m[0] = U8TO32_BE(Arrays.copyOfRange(datablock,0,4));
+ m[1] = U8TO32_BE(Arrays.copyOfRange(datablock,4,8));
+ m[2] = U8TO32_BE(Arrays.copyOfRange(datablock,8,12));
+ m[3] = U8TO32_BE(Arrays.copyOfRange(datablock,12,16));
+ m[4] = U8TO32_BE(Arrays.copyOfRange(datablock,16,20));
+ m[5] = U8TO32_BE(Arrays.copyOfRange(datablock,20,24));
+ m[6] = U8TO32_BE(Arrays.copyOfRange(datablock,24,28));
+ m[7] = U8TO32_BE(Arrays.copyOfRange(datablock,28,32));
+ m[8] = U8TO32_BE(Arrays.copyOfRange(datablock,32,36));
+ m[9] = U8TO32_BE(Arrays.copyOfRange(datablock,36,40));
+ m[10] = U8TO32_BE(Arrays.copyOfRange(datablock,40,44));
+ m[11] = U8TO32_BE(Arrays.copyOfRange(datablock,44,48));
+ m[12] = U8TO32_BE(Arrays.copyOfRange(datablock,48,52));
+ m[13] = U8TO32_BE(Arrays.copyOfRange(datablock,52,56));
+ m[14] = U8TO32_BE(Arrays.copyOfRange(datablock,56,60));
+ m[15] = U8TO32_BE(Arrays.copyOfRange(datablock,60,64));
+ return m;
+ }
+ /* initialization */
+
+ /* do 14 rounds */
+ /* column step */
+ public long[] round(long m[], long[] v16_input, short round_num){
+
+ v16_output = G32(v16_input, m, round_num, 0, 4, 8,12, 0);
+ v16_output = G32(v16_input, m, round_num, 1, 5, 9,13, 1);
+ v16_output = G32(v16_input, m, round_num, 2, 6,10,14, 2);
+ v16_output = G32(v16_input, m, round_num, 3, 7,11,15, 3);
+
+ /* diagonal step */
+ v16_output = G32(v16_input, m, round_num, 0, 5,10,15, 4);
+ v16_output = G32(v16_input, m, round_num, 1, 6,11,12, 5);
+ v16_output = G32(v16_input, m, round_num, 2, 7, 8,13, 6);
+ v16_output = G32(v16_input, m, round_num, 3, 4, 9,14, 7);
+
+ return v16_output;
+ }
+
+ private long[] G32(long v[], long m[], short round, int a, int b, int c, int d, int i){
+ m1=m[sigma[round][2*i]];
+ c1=c32[sigma[round][2*i+1]];
+ m2=m[sigma[round][2*i+1]];
+ c2=c32[sigma[round][2*i]] ;
+ v[a] = ADD32(v[a],v[b])+XOR32(m[sigma[round][2*i]], c32[sigma[round][2*i+1]]);
+ v[d] = ROT32(XOR32(v[d],v[a]),16);
+ v[c] = ADD32(v[c],v[d]);
+ v[b] = ROT32(XOR32(v[b],v[c]),12);
+ v[a] = ADD32(v[a],v[b])+XOR32(m[sigma[round][2*i+1]], c32[sigma[round][2*i]]);
+ v[d] = ROT32(XOR32(v[d],v[a]), 8);
+ v[c] = ADD32(v[c],v[d]);
+ v[b] = ROT32(XOR32(v[b],v[c]), 7);
+ return v;
+ }
+
+ private long ROT32(long x, long n){
+ return (((x<<(32-n))|(x>>n))& 0xffffffffL);
+ }
+
+ private long ADD32(long x, long y){
+ return ((x + y) & 0xffffffffL);
+ }
+
+ private long XOR32(long x, long y){
+ return ((x ^ y) & 0xffffffffL);
+ }
+
+ public static int U8TO32_BE(byte[] p){
+ int q = java.nio.ByteBuffer.wrap(p).getInt();
+ return q; }
+
+
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab2.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab2.java
new file mode 100755
index 0000000..28bf8b8
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab2.java
@@ -0,0 +1,99 @@
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.jcryptool.visual.sha3candidates.views.Messages;
+
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.c32;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+
+
+public class Blake_tab2 {
+ public Table table;
+ public Table table1;
+ public Browser Hashpage;
+ public String hashName="BLAKE224", inputText=null, saltText=null;
+ public HashFunction hash=null;
+ public byte[] digest=null;
+ public TableItem item[];
+ public TabFolder tabFolder;
+ public Group m_panel;
+ public Label m16_index[]=new Label[16];
+ public Text m16_value[]=new Text[16];
+ public Group s_panel;
+ public Label s4_index[]=new Label[4];;
+ public Text s4_value[]=new Text[4];;
+ public TabItem tabItem1;
+ public Group tabpage;
+ public Group IV_panel;
+ public Label IV8_index[]=new Label[8];;
+ public Text IV8_value[]=new Text[8];;
+ public Group c_panel;
+ public Label c16_index[]=new Label[16];;
+ public Text c16_value[]=new Text[16];;
+ public GC gc;
+ public Blake_Action BLAKE224;
+ public GridLayout grid;
+ public Group sigma_panel;
+ public Label sigma_value[][]=new Label[10][16];
+ public short sigma[][] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 }
+ };
+
+ public Blake_tab2(TabFolder tabFolder_input, Group tabpage_input){
+ tabFolder=tabFolder_input;
+ tabpage=tabpage_input;
+ for(int i=0; i<10; i++){
+ for(int j=0; j<16; j++){
+ sigma_value[i][j]=new Label(tabpage, SWT.BORDER);
+ sigma_value[i][j].setBounds(50+i*150, 50+20*j, 150, 20);
+ sigma_value[i][j].setText(""+sigma[i][j]);
+ sigma_value[i][j].setAlignment(SWT.CENTER);
+
+ }
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3.java
new file mode 100755
index 0000000..e65578f
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/Blake_tab3.java
@@ -0,0 +1,345 @@
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.jcryptool.visual.sha3candidates.views.Messages;
+
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.c32;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+
+
+public class Blake_tab3 {
+ public Table table;
+ public Table table1;
+ public Browser Hashpage;
+ public String hashName="BLAKE224", inputText=null, saltText=null;
+ public HashFunction hash=null;
+ public byte[] digest=null;
+ public TableItem item[];
+ public TabFolder tabFolder;
+ public Group m_panel;
+ public Label m16_index[]=new Label[16];
+ public Text m16_value[]=new Text[16];
+ public Group s_panel;
+ public Label s4_index[]=new Label[4];;
+ public Text s4_value[]=new Text[4];;
+ public TabItem tabItem1;
+ public Group tabpage;
+ public Group IV_panel;
+ public Label IV8_index[]=new Label[8];;
+ public Text IV8_value[]=new Text[8];;
+ public Group c_panel;
+ public Label c16_index[]=new Label[16];;
+ public Text c16_value[]=new Text[16];;
+ public GC gc;
+ public Blake_Action BLAKE224;
+ public GridLayout grid;
+ public TabItem tabItem;
+ public Group h_panel;
+ public Label h8_index[]=new Label[8];;
+ public Text h8_value[]=new Text[8];;
+ public Label v16_index[]=new Label[16];
+ public Text v16_value[]=new Text[16];
+ public long v16_initial[]=new long[16];
+ public long v16_input[]=new long[16];
+ public long v16_output[]=new long[16];
+ public Group g0_panel[]=new Group[8];
+ public Label g0_index[][]=new Label[8][4];
+ public Text g0_value[][]=new Text[8][4];
+ public Group g1_panel[]=new Group[8];
+ public Label g1_index[][]=new Label[8][4];
+ public Text g1_value[][]=new Text[8][4];
+ public Text hash_text;
+ public String hash_output="0";
+ public Label final_algorithm;
+
+ public Blake_tab3(TabFolder tabFolder_input, Group tabpage_input){
+ tabFolder=tabFolder_input;
+ tabpage=tabpage_input;
+ create_tab0();
+ }
+
+
+ public void load(long v16[], String output){
+ v16_input=v16;
+ v16_initial=v16;
+ v16_output=v16;
+ hash_output=output;
+ }
+
+ public void create_tab0(){
+ gc = new GC(tabpage);
+ gc.setLineWidth(4);
+
+ c_panel = new Group(tabpage,SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ c_panel.setBounds(60, 420, 620, 180);
+ create_4X4_matrix(c_panel, "c", c16_index, c16_value, 20, 150);
+ for(int i=0; i<16; i++){
+ c16_value[i].setText("0x"+ Integer.toHexString((int)(c32[i]>>5))+ Integer.toHexString((int)(c32[i])));
+ }
+
+ h_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ h_panel.setBounds(60, 600, 420, 100);
+ create_4X2_matrix(h_panel, "h", h8_index, h8_value, 20, 100);
+ for(int i=0; i<8; i++){
+ h8_value[i].setText("0x"+ Integer.toHexString(IV224[i]));
+ }
+
+ s_panel = new Group(tabpage, SWT.BORDER| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ s_panel.setBounds(60, 700, 420, 60);
+ create_4X1_matrix(s_panel, "s", s4_index, s4_value, 20, 100);
+
+ hash_text=new Text(tabpage, SWT.BORDER);
+ hash_text.setBounds(760, 500, 620, 180);
+
+
+ final_algorithm=new Label(tabpage, SWT.BORDER);
+ final_algorithm.setBounds(780, 100, 620, 3500);
+ final_algorithm.setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.ITALIC));
+ final_algorithm.setText("\n\n\nh0 = h0 XOR s0 XOR v0 XOR v8\n"
+ + "h1 = h1 XOR s1 XOR v1 XOR v9\n"
+ + "h2 = h2 XOR s2 XOR v2 XOR v10\n"
+ + "h3 = h3 XOR s3 XOR v3 XOR v11\n"
+ + "h4 = h4 XOR s0 XOR v4 XOR v12\n"
+ + "h5 = h5 XOR s1 XOR v5 XOR v13\n"
+ + "h6 = h6 XOR s2 XOR v6 XOR v14\n"
+ + "h7 h7 XOR s3 XOR v7 XOR v15\n\n"
+ + "h1~h7 are outputs");
+ final_algorithm.setAlignment(SWT.CENTER);
+
+ Button MessageButton = new Button(tabpage, SWT.NONE);
+ MessageButton.setText("Click to continue");
+ MessageButton.setBounds(780, 10, 620, 50);
+ MessageButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ gc.drawLine(660,110,780,110);
+
+ gc.drawLine(680,500,720,500);
+ gc.drawLine(720,500,720,130);
+ gc.drawLine(720,130,780,130);
+
+ gc.drawLine(480,660,740,660);
+ gc.drawLine(740,660,740,150);
+ gc.drawLine(740,150,780,150);
+
+ gc.drawLine(480,750,760,750);
+ gc.drawLine(760,750,760,170);
+ gc.drawLine(760,170,780,170);
+
+ gc.drawLine(1090,400,1090,500);
+
+ hash_text.setText(hash_output);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ int width=150, height=20;
+
+ for(int i=0; i<8; i++){
+ g0_panel[0] = new Group(tabpage, SWT.NONE| SWT.SHADOW_IN|SWT.SHADOW_OUT);
+ g0_panel[0].setBounds(60, 10+50*i, 610, 50);
+ g0_index[i][0] = new Label(g0_panel[0], SWT.NONE);
+ g0_index[i][0].setBounds(5+width*0, 5, width, height);
+ g0_index[i][0].setAlignment(SWT.CENTER);
+ g0_value[i][0] = new Text(g0_panel[0], SWT.BORDER|SWT.CENTER);
+ g0_value[i][0].setBounds(5+width*0, 5+height, width, height);
+ g0_index[i][1] = new Label(g0_panel[0], SWT.NONE);
+ g0_index[i][1].setBounds(5+width*1, 5, width, height);
+ g0_index[i][1].setAlignment(SWT.CENTER);
+ g0_value[i][1] = new Text(g0_panel[0], SWT.BORDER|SWT.CENTER);
+ g0_value[i][1].setBounds(5+width*1, 5+height, width, height);
+ g0_index[i][2] = new Label(g0_panel[0], SWT.NONE);
+ g0_index[i][2].setBounds(5+width*2, 5, width, height);
+ g0_index[i][2].setAlignment(SWT.CENTER);
+ g0_value[i][2] = new Text(g0_panel[0], SWT.BORDER|SWT.CENTER);
+ g0_value[i][2].setBounds(5+width*2, 5+height, width, height);
+ g0_index[i][3] = new Label(g0_panel[0], SWT.NONE);
+ g0_index[i][3].setBounds(5+width*3, 5, width, height);
+ g0_index[i][3].setAlignment(SWT.CENTER);
+ g0_value[i][3] = new Text(g0_panel[0], SWT.BORDER|SWT.CENTER);
+ g0_value[i][3].setBounds(5+width*3, 5+height, width, height);
+ }
+
+
+ g0_index[0][0].setText("v0");
+ g0_index[0][1].setText("v4");
+ g0_index[0][2].setText("v8");
+ g0_index[0][3].setText("v12");
+ g0_index[1][0].setText("v1");
+ g0_index[1][1].setText("v5");
+ g0_index[1][2].setText("v9");
+ g0_index[1][3].setText("v13");
+ g0_index[2][0].setText("v2");
+ g0_index[2][1].setText("v6");
+ g0_index[2][2].setText("v10");
+ g0_index[2][3].setText("v14");
+ g0_index[3][0].setText("v3");
+ g0_index[3][1].setText("v7");
+ g0_index[3][2].setText("v11");
+ g0_index[3][3].setText("v15");
+ g0_index[4][0].setText("v0");
+ g0_index[4][1].setText("v5");
+ g0_index[4][2].setText("v10");
+ g0_index[4][3].setText("v15");
+ g0_index[5][0].setText("v1");
+ g0_index[5][1].setText("v6");
+ g0_index[5][2].setText("v11");
+ g0_index[5][3].setText("v12");
+ g0_index[6][0].setText("v2");
+ g0_index[6][1].setText("v7");
+ g0_index[6][2].setText("v8");
+ g0_index[6][3].setText("v13");
+ g0_index[7][0].setText("v3");
+ g0_index[7][1].setText("v4");
+ g0_index[7][2].setText("v9");
+ g0_index[7][3].setText("v14");
+ }
+
+ public void load_v16(){
+ g0_value[0][0].setText("0x"+v16_input[0]);
+ g0_value[0][1].setText("0x"+v16_input[4]);
+ g0_value[0][2].setText("0x"+v16_input[8]);
+ g0_value[0][3].setText("0x"+v16_input[12]);
+ g0_value[1][0].setText("0x"+v16_input[1]);
+ g0_value[1][1].setText("0x"+v16_input[5]);
+ g0_value[1][2].setText("0x"+v16_input[9]);
+ g0_value[1][3].setText("0x"+v16_input[13]);
+ g0_value[2][0].setText("0x"+v16_input[2]);
+ g0_value[2][1].setText("0x"+v16_input[6]);
+ g0_value[2][2].setText("0x"+v16_input[10]);
+ g0_value[2][3].setText("0x"+v16_input[14]);
+ g0_value[3][0].setText("0x"+v16_input[3]);
+ g0_value[3][1].setText("0x"+v16_input[7]);
+ g0_value[3][2].setText("0x"+v16_input[11]);
+ g0_value[3][3].setText("0x"+v16_input[15]);
+ g0_value[4][0].setText("0x"+v16_input[0]);
+ g0_value[4][1].setText("0x"+v16_input[5]);
+ g0_value[4][2].setText("0x"+v16_input[10]);
+ g0_value[4][3].setText("0x"+v16_input[15]);
+ g0_value[5][0].setText("0x"+v16_input[1]);
+ g0_value[5][1].setText("0x"+v16_input[6]);
+ g0_value[5][2].setText("0x"+v16_input[11]);
+ g0_value[5][3].setText("0x"+v16_input[12]);
+ g0_value[6][0].setText("0x"+v16_input[2]);
+ g0_value[6][1].setText("0x"+v16_input[7]);
+ g0_value[6][2].setText("0x"+v16_input[8]);
+ g0_value[6][3].setText("0x"+v16_input[13]);
+ g0_value[7][0].setText("0x"+v16_input[3]);
+ g0_value[7][1].setText("0x"+v16_input[4]);
+ g0_value[7][2].setText("0x"+v16_input[9]);
+ g0_value[7][3].setText("0x"+v16_input[14]);
+
+}
+
+ public void create_2X1_matrix(Group t_panel, String name, Label t2_index[], Text t2_value[], int height, int width){
+ for(int k=0; k<2; k++){
+ t2_index[k] = new Label(t_panel, SWT.NONE);
+ t2_index[k].setBounds(5+width*k, 5, width, height);
+ t2_index[k].setAlignment(SWT.CENTER);
+ t2_index[k].setText(name+k);
+ t2_value[k] = new Text(t_panel, SWT.BORDER|SWT.CENTER);
+ t2_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X1_matrix(Group s_panel, String name, Label s4_index[], Text s4_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ s4_index[k] = new Label(s_panel, SWT.NONE);
+ s4_index[k].setBounds(5+width*k, 5, width, height);
+ s4_index[k].setText(name+k);
+ s4_index[k].setAlignment(SWT.CENTER);
+ s4_value[k] = new Text(s_panel, SWT.BORDER|SWT.CENTER);
+ s4_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ }
+
+ public void create_4X2_matrix(Group h_panel, String name, Label h8_index[], Text h8_value[], int height, int width){
+ for(int k=0; k<4; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*k, 5, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*k, 5+height, width, height);
+ }
+ for(int k=4; k<8; k++){
+ h8_index[k] = new Label(h_panel, SWT.NONE);
+ h8_index[k].setBounds(5+width*(k-4), 5+height*2, width, height);
+ h8_index[k].setAlignment(SWT.CENTER);
+ h8_index[k].setText(name+k);
+ h8_value[k] = new Text(h_panel, SWT.BORDER|SWT.CENTER);
+ h8_value[k].setBounds(5+width*(k-4), 5+height*3, width, height);
+ }
+
+ }
+ public void create_4X4_matrix(Group c_panel, String name, Label c16_index[], Text c16_value[], int height, int width){
+ for(int i=0; i<4; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*i, 5, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=0; i<4; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER | SWT.CENTER);
+ c16_value[i].setBounds(5+width*i, 5+height, width, height);
+ }
+ for(int i=4; i<8; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-4), 5+2*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=4; i<8; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-4), 5+3*height, width, height);
+ }
+ for(int i=8; i<12; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-8), 5+4*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=8; i<12; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-8), 5+5*height, width, height);
+ }
+ for(int i=12; i<16; i++){
+ c16_index[i] = new Label(c_panel, SWT.NONE);
+ c16_index[i].setBounds(5+width*(i-12), 5+6*height, width, height);
+ c16_index[i].setText(name+i);
+ c16_index[i].setAlignment(SWT.CENTER);
+ }
+ for(int i=12; i<16; i++){
+ c16_value[i] = new Text(c_panel, SWT.BORDER|SWT.CENTER);
+ c16_value[i].setBounds(5+width*(i-12), 5+7*height, width, height);
+ }
+ }
+
+ public void create_m(Blake_Action BLAKE, String inputText, String saltText){
+ BLAKE224=BLAKE;
+ }
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/fig1.png b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/fig1.png
new file mode 100755
index 0000000..63d3990
Binary files /dev/null and b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/fig1.png differ
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/package-info.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/package-info.java
new file mode 100755
index 0000000..f099f9e
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/BLAKE/package-info.java
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+/**
+ * @author ZWC
+ *
+ */
+package org.jcryptool.visual.sha3candidates.algorithms.BLAKE;
+
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAction.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAction.java
new file mode 100755
index 0000000..26c12e2
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAction.java
@@ -0,0 +1,29 @@
+// -----BEGIN DISCLAIMER-----
+/*******************************************************************************
+ * Copyright (c) 2010 JCrypTool team and contributors
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+// -----END DISCLAIMER-----
+package org.jcryptool.visual.sha3candidates.algorithms.ECHO;
+
+/**
+ * The action class of ECHO.
+ *
+ * @author Michael Starzer
+ *
+ */
+public class ECHOAction {
+
+ public byte[] run(int hashlength, String str) {
+ ECHOAlgorithm e = new ECHOAlgorithm(hashlength, str.getBytes());
+ return e.getHash();
+ }
+
+ public byte[] run(int hashlength, String str, String salt) {
+ ECHOAlgorithm e = new ECHOAlgorithm(hashlength, str.getBytes(), salt);
+ return e.getHash();
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAlgorithm.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAlgorithm.java
new file mode 100755
index 0000000..30ec455
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/ECHO/ECHOAlgorithm.java
@@ -0,0 +1,602 @@
+// -----BEGIN DISCLAIMER-----
+/*******************************************************************************
+ * Copyright (c) 2010 JCrypTool team and contributors
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+// -----END DISCLAIMER-----
+package org.jcryptool.visual.sha3candidates.algorithms.ECHO;
+
+/**
+ *
+ * @author Felix Tenne
+ */
+
+public class ECHOAlgorithm {
+ private int SUCCESS=0;
+ private int FAIL=1;
+ private int BAD_HASHBITLEN=2;
+ private int STATE_NULL=3;
+
+ private ECHOHashState state;
+ private byte hashval[];
+ private int status;
+
+ private final short Logtable[] = {
+ 0, 0, 25, 1, 50, 2, 26, 198, 75, 199, 27, 104, 51, 238, 223, 3,
+ 100, 4, 224, 14, 52, 141, 129, 239, 76, 113, 8, 200, 248, 105, 28, 193,
+ 125, 194, 29, 181, 249, 185, 39, 106, 77, 228, 166, 114, 154, 201, 9, 120,
+ 101, 47, 138, 5, 33, 15, 225, 36, 18, 240, 130, 69, 53, 147, 218, 142,
+ 150, 143, 219, 189, 54, 208, 206, 148, 19, 92, 210, 241, 64, 70, 131, 56,
+ 102, 221, 253, 48, 191, 6, 139, 98, 179, 37, 226, 152, 34, 136, 145, 16,
+ 126, 110, 72, 195, 163, 182, 30, 66, 58, 107, 40, 84, 250, 133, 61, 186,
+ 43, 121, 10, 21, 155, 159, 94, 202, 78, 212, 172, 229, 243, 115, 167, 87,
+ 175, 88, 168, 80, 244, 234, 214, 116, 79, 174, 233, 213, 231, 230, 173, 232,
+ 44, 215, 117, 122, 235, 22, 11, 245, 89, 203, 95, 176, 156, 169, 81, 160,
+ 127, 12, 246, 111, 23, 196, 73, 236, 216, 67, 31, 45, 164, 118, 123, 183,
+ 204, 187, 62, 90, 251, 96, 177, 134, 59, 82, 161, 108, 170, 85, 41, 157,
+ 151, 178, 135, 144, 97, 190, 220, 252, 188, 149, 207, 205, 55, 63, 91, 209,
+ 83, 57, 132, 60, 65, 162, 109, 71, 20, 42, 158, 93, 86, 242, 211, 171,
+ 68, 17, 146, 217, 35, 32, 46, 137, 180, 124, 184, 38, 119, 153, 227, 165,
+ 103, 74, 237, 222, 197, 49, 254, 24, 13, 99, 140, 128, 192, 247, 112, 7,
+ };
+
+ private final short Alogtable[] = {
+ 1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53,
+ 95, 225, 56, 72, 216, 115, 149, 164, 247, 2, 6, 10, 30, 34, 102, 170,
+ 229, 52, 92, 228, 55, 89, 235, 38, 106, 190, 217, 112, 144, 171, 230, 49,
+ 83, 245, 4, 12, 20, 60, 68, 204, 79, 209, 104, 184, 211, 110, 178, 205,
+ 76, 212, 103, 169, 224, 59, 77, 215, 98, 166, 241, 8, 24, 40, 120, 136,
+ 131, 158, 185, 208, 107, 189, 220, 127, 129, 152, 179, 206, 73, 219, 118, 154,
+ 181, 196, 87, 249, 16, 48, 80, 240, 11, 29, 39, 105, 187, 214, 97, 163,
+ 254, 25, 43, 125, 135, 146, 173, 236, 47, 113, 147, 174, 233, 32, 96, 160,
+ 251, 22, 58, 78, 210, 109, 183, 194, 93, 231, 50, 86, 250, 21, 63, 65,
+ 195, 94, 226, 61, 71, 201, 64, 192, 91, 237, 44, 116, 156, 191, 218, 117,
+ 159, 186, 213, 100, 172, 239, 42, 126, 130, 157, 188, 223, 122, 142, 137, 128,
+ 155, 182, 193, 88, 232, 35, 101, 175, 234, 37, 111, 177, 200, 67, 197, 84,
+ 252, 31, 33, 99, 165, 244, 7, 9, 27, 45, 119, 153, 176, 203, 70, 202,
+ 69, 207, 74, 222, 121, 139, 134, 145, 168, 227, 62, 66, 198, 81, 243, 14,
+ 18, 54, 90, 238, 41, 123, 141, 140, 143, 138, 133, 148, 167, 242, 13, 23,
+ 57, 75, 221, 124, 132, 151, 162, 253, 28, 36, 108, 180, 199, 82, 246, 1,
+ };
+
+ private final short S[] = {
+ 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,
+ 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192,
+ 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21,
+ 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117,
+ 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132,
+ 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207,
+ 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168,
+ 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210,
+ 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115,
+ 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219,
+ 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121,
+ 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8,
+ 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138,
+ 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158,
+ 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223,
+ 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22,
+ };
+
+ ECHOAlgorithm(int hashbitlen, byte[] data){
+ this.status = FAIL;
+ this.hashval = new byte[hashbitlen/8];
+ this.state = new ECHOHashState();
+
+ status = Hash(hashbitlen, data);
+ }
+
+ ECHOAlgorithm(int hashbitlen, byte[] data, String salt){
+ this.status = FAIL;
+ this.hashval = new byte[hashbitlen/8];
+ this.state = new ECHOHashState();
+
+ setSalt(hexStrToByteField(salt));
+
+ status = Hash(hashbitlen, data);
+ }
+
+ public int getStatus(){
+ return this.status;
+ }
+
+ public byte[] getHash(){
+ return this.hashval;
+ }
+
+ private short byteToShort(byte b){
+ short s=0;
+
+ if(b<0){
+ s+=128;
+ b+=128;
+ }
+
+ s+=b;
+ return (short)s;
+ }
+
+ private short mul(short a, short b) {
+ /* multiply two elements of GF(2^m)
+ * needed for MixColumn and InvMixColumn
+ */
+ if(a!=0 && b!=0)
+ return Alogtable[(Logtable[a] + Logtable[b])%255];
+
+ return 0;
+ }
+
+ private byte[][] AddRoundKey(byte a[][], byte k[][]) {
+ /* Exor corresponding text input and key input bytes
+ */
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 4; j++)
+ a[i][j] = (byte)(byteToShort(a[i][j]) ^ byteToShort(k[i][j]));
+
+ return a;
+ }
+
+ private byte[][] ShiftRows(byte a[][]) {
+ /* Row 0 remains unchanged
+ * The other three rows are shifted a variable amount
+ */
+ byte tmp[] = new byte[4];
+ int i, j;
+
+ for(i = 1; i < 4; i++) {
+ for(j = 0; j < 4; j++)
+ tmp[j] = a[i][(j + i) % 4];
+ for(j = 0; j < 4; j++)
+ a[i][j] = tmp[j];
+ }
+
+ return a;
+ }
+
+ private byte[][] SubByte(byte a[][]) {
+ /* Replace every byte of the input by the byte at that place
+ * in the nonlinear S-box.
+ */
+ int i, j;
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 4; j++){
+ a[i][j] = (byte)S[byteToShort(a[i][j])] ;
+ }
+
+ return a;
+ }
+
+ private byte[][] MixColumns(byte a[][]) {
+ /* Mix the four bytes of every column in a linear way */
+ byte b[][] = new byte[4][4];
+ int i, j;
+
+ for(j = 0; j < 4; j++)
+ for(i = 0; i < 4; i++)
+ b[i][j] = (byte)(
+ mul( (short)2, byteToShort(a[i][j]) )
+ ^ mul( (short)3, byteToShort( a[(i + 1) % 4][j] ) )
+ ^ byteToShort(a[(i + 2) % 4][j])
+ ^ byteToShort(a[(i + 3) % 4][j]));
+
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 4; j++)
+ a[i][j] = b[i][j];
+
+ return a;
+ }
+
+ private byte[][] aes(byte a[][], byte k[][]){
+ a=SubByte(a);
+ a=ShiftRows(a);
+ a=MixColumns(a);
+ a=AddRoundKey(a,k);
+
+ return a;
+ }
+
+ private int Init(int hashbitlen){
+ int i,j;
+
+ if (state==null){
+ return STATE_NULL;
+ }
+
+ if((hashbitlen >= 128) && (hashbitlen <= 512)){
+ state.hashbitlen = (short)hashbitlen;
+ }else{
+ return BAD_HASHBITLEN;
+ }
+
+ if(hashbitlen > 256){
+ state.cv_size = 1024;
+ state.message_size = 1024;
+ state.rounds = 10;
+ }else{
+ state.cv_size = 512;
+ state.message_size = 1536;
+ state.rounds = 8;
+ }
+
+ for(j=0; j>8);
+ }
+ }
+
+ state.index = (short)(state.cv_size/8);
+ return SUCCESS;
+ }
+
+ private void Push(byte a){
+ short help[] = state.getAddress(state.index++);
+ state.tab[help[0]][help[1]][help[2]][help[3]] = a;
+ }
+
+ private byte Pop(){
+ short help[] = state.getAddress(state.index++);
+ return state.tab[help[0]][help[1]][help[2]][help[3]];
+ }
+
+ private void Backup(){
+ for(int i=0; i<4; i++){
+ for(int j=0; j<4; j++){
+ for(int k=0; k<4; k++){
+ for(int l=0; l<4; l++){
+ state.tab_backup[i][j][k][l] = state.tab[i][j][k][l];
+ }
+ }
+ }
+ }
+ }
+
+ private void BigSubWords(){
+ int i,j;
+ state.k1[0][1] = (byte)(state.counter_hi >> 0);
+ state.k1[1][1] = (byte)(state.counter_hi >> 8);
+ state.k1[2][1] = (byte)(state.counter_hi >> 16);
+ state.k1[3][1] = (byte)(state.counter_hi >> 24);
+
+ for(j=0; j<4; j++){
+ for(i=0; i<4; i++){
+ state.k1[0][0] = (byte)(state.counter_lo >> 0);
+ state.k1[1][0] = (byte)(state.counter_lo >> 8);
+ state.k1[2][0] = (byte)(state.counter_lo >> 16);
+ state.k1[3][0] = (byte)(state.counter_lo >> 24);
+ state.tab[i][j] = aes(state.tab[i][j], state.k1);
+ state.tab[i][j] = aes(state.tab[i][j], state.k2);
+ state.counter_lo++;
+
+ if (state.counter_lo == 0){
+ state.counter_hi++;
+ state.k1[0][1] = (byte)(state.counter_hi >> 0);
+ state.k1[1][1] = (byte)(state.counter_hi >> 8);
+ state.k1[2][1] = (byte)(state.counter_hi >> 16);
+ state.k1[3][1] = (byte)(state.counter_hi >> 24);
+ }
+ }
+ }
+ }
+
+ private void BigShiftRows(){
+ byte tmp[][][] = new byte[4][4][4];
+ int m;
+
+ for(int i = 1; i < 4; i++) {
+ for(int j = 0; j < 4; j++){
+ m = (j + i) % 4;
+ for(int k = 0; k < 4; k++){
+ for(int l = 0; l < 4; l++){
+ tmp[j][k][l] = state.tab[i][m][k][l];
+ }
+ }
+ }
+
+ for(int j = 0; j < 4; j++) {
+ for(int k = 0; k < 4; k++){
+ for(int l = 0; l < 4; l++){
+ state.tab[i][j][k][l] = tmp[j][k][l];
+ }
+ }
+ }
+ }
+ }
+
+ private byte[] Mix4bytes(short a, short b, short c, short d){
+ /* Mix four bytes in a linear way */
+ byte field[] = new byte[4];
+
+ field[0] = (byte)(mul((short)2, a)^mul((short)3, b)^c^d);
+ field[1] = (byte)(mul((short)2, b)^mul((short)3, c)^d^a);
+ field[2] = (byte)(mul((short)2, c)^mul((short)3, d)^a^b);
+ field[3] = (byte)(mul((short)2, d)^mul((short)3, a)^b^c);
+
+ return field;
+ }
+
+ private void BigMixColumns(){
+ int i,j,k;
+ byte tmp[];
+
+ for(i=0; i<4; i++){
+ for(j=0; j<4; j++){
+ for(k=0; k<4; k++){
+ tmp=Mix4bytes(byteToShort(state.tab[0][i][j][k])
+ , byteToShort(state.tab[1][i][j][k])
+ , byteToShort(state.tab[2][i][j][k])
+ , byteToShort(state.tab[3][i][j][k]));
+
+ state.tab[0][i][j][k]=tmp[0];
+ state.tab[1][i][j][k]=tmp[1];
+ state.tab[2][i][j][k]=tmp[2];
+ state.tab[3][i][j][k]=tmp[3];
+ }
+ }
+ }
+ }
+
+ private void BigFinal(){
+ int i,j,k;
+
+ if (state.cv_size == 512){
+ for(i=0; i<4; i++){
+ for(k=0; k<4; k++){
+ for(j=0; j<4; j++){
+ state.tab[i][0][j][k] =
+ (byte)(byteToShort(state.tab_backup[i][0][j][k]) ^
+ byteToShort(state.tab_backup[i][1][j][k]) ^
+ byteToShort(state.tab_backup[i][2][j][k]) ^
+ byteToShort(state.tab_backup[i][3][j][k]) ^
+ byteToShort(state.tab[i][0][j][k]) ^
+ byteToShort(state.tab[i][1][j][k]) ^
+ byteToShort(state.tab[i][2][j][k]) ^
+ byteToShort(state.tab[i][3][j][k])) ;
+ }
+ }
+ }
+ }else{
+ for(i=0; i<4; i++){
+ for(k=0; k<4; k++){
+ for(j=0; j<4; j++){
+ state.tab[i][0][j][k] =
+ (byte)(byteToShort(state.tab_backup[i][0][j][k]) ^
+ byteToShort(state.tab_backup[i][2][j][k]) ^
+ byteToShort(state.tab[i][0][j][k]) ^
+ byteToShort(state.tab[i][2][j][k]));
+ }
+ }
+ }
+
+ for(i=0; i<4; i++){
+ for(k=0; k<4; k++){
+ for(j=0; j<4; j++){
+ state.tab[i][1][j][k] =
+ (byte)(byteToShort(state.tab_backup[i][1][j][k]) ^
+ byteToShort(state.tab_backup[i][3][j][k]) ^
+ byteToShort(state.tab[i][1][j][k]) ^
+ byteToShort(state.tab[i][3][j][k]));
+ }
+ }
+ }
+ }
+ }
+
+ private void Compress(){
+ Backup();
+
+ state.counter_hi = state.messlenhi;
+ state.counter_lo = state.messlenlo;
+
+ for(int i=0; i 256 - 16 - 2)
+ {
+ //padding with "0"
+ while (state.index < 256)
+ {
+ Push((byte)0);
+ }
+ Compress();
+ state.index = (short)(state.cv_size/8);
+ //no message bit in next block
+ nFinalPadding = 1;
+ }
+ //padding last block
+ while (state.index < 256 - 16 - 2)
+ {
+ Push((byte)0);
+ }
+ //HSIZE (2 bytes)
+ Push((byte)state.hashbitlen);
+ Push((byte)(state.hashbitlen >> 8));
+ //message length (8 bytes)
+ Push((byte)(state.messlenlo >> 0));
+ Push((byte)(state.messlenlo >> 8));
+ Push((byte)(state.messlenlo >> 16));
+ Push((byte)(state.messlenlo >> 24));
+ Push((byte)(state.messlenhi >> 0));
+ Push((byte)(state.messlenhi >> 8));
+ Push((byte)(state.messlenhi >> 16));
+ Push((byte)(state.messlenhi >> 24));
+
+ //High 64 bits of counter set to 0
+ while (state.index < 256)
+ {
+ Push((byte)0);
+ }
+ if (nFinalPadding != 0)
+ {
+ state.messlenhi = 0;
+ state.messlenlo = 0;
+ }
+ Compress();
+ }
+
+ private int Final(){
+ int i;
+
+ int MASK_AND[] ={
+ 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE
+ };
+
+ if (state == null){
+ return STATE_NULL;
+ }
+
+ if (state.computed != 0){
+ return FAIL;
+ }
+
+ Pad();
+
+ /* output truncated hash value */
+ state.index = 0;
+ for(i=0; i<((state.hashbitlen + 7)/8); i++){
+ hashval[i] = Pop();
+ }
+
+ //last byte truncation
+ hashval[i-1] &= MASK_AND[state.hashbitlen % 8];
+
+ //clean up
+ state.index = 0;
+
+ for (i=0; i<256; i++){
+ Push((byte)0);
+ }
+
+ state.computed = 1;
+
+ return SUCCESS;
+ }
+
+ private int Hash(int hashbitlen, byte[] data){
+ int F;
+ F = Init(hashbitlen);
+
+ if(F != SUCCESS)
+ return F;
+
+ F = Update(data);
+
+ if(F != SUCCESS)
+ return F;
+
+ return Final();
+ }
+
+ private void setSalt(byte[] salt){
+ if(salt != null && salt.length == 16){
+ //salt low 64 bits
+ state.k2[0][0] = salt[0];
+ state.k2[1][0] = salt[1];
+ state.k2[2][0] = salt[2];
+ state.k2[3][0] = salt[3];
+ state.k2[0][1] = salt[4];
+ state.k2[1][1] = salt[5];
+ state.k2[2][1] = salt[6];
+ state.k2[3][1] = salt[7];
+ //salt high 64 bits
+ state.k2[0][2] = salt[8];
+ state.k2[1][2] = salt[9];
+ state.k2[2][2] = salt[10];
+ state.k2[3][2] = salt[11];
+ state.k2[0][3] = salt[12];
+ state.k2[1][3] = salt[13];
+ state.k2[2][3] = salt[14];
+ state.k2[3][3] = salt[15];
+ }
+ }
+
+ private byte[] hexStrToByteField(String hexStr){
+ if(hexStr.length()%2==0){
+ byte [] bytes = new byte[hexStr.length()/2];
+ int i,j;
+
+ try{
+ for(i=0,j=0;j= 128) && (hashbitlen <= 512)){
+ state.hashbitlen = (short)hashbitlen;
+ }else{
+ return BAD_HASHBITLEN;
+ }
+
+ if(hashbitlen > 256){
+ state.cv_size = 1024;
+ state.message_size = 1024;
+ state.rounds = 10;
+ }else{
+ state.cv_size = 512;
+ state.message_size = 1536;
+ state.rounds = 8;
+ }
+
+ for(j=0; j>8);
+ }
+ }
+
+ state.index = (short)(state.cv_size/8);
+ return SUCCESS;
+ }
+
+ private void Push(byte a){
+ short help[] = state.getAddress(state.index++);
+ state.tab[help[0]][help[1]][help[2]][help[3]] = a;
+ }
+
+ private byte Pop(){
+ short help[] = state.getAddress(state.index++);
+ return state.tab[help[0]][help[1]][help[2]][help[3]];
+ }
+
+ private void Backup(){
+ for(int i=0; i<4; i++){
+ for(int j=0; j<4; j++){
+ for(int k=0; k<4; k++){
+ for(int l=0; l<4; l++){
+ state.tab_backup[i][j][k][l] = state.tab[i][j][k][l];
+ }
+ }
+ }
+ }
+ }
+
+ private void BigSubWords(){
+ int i,j;
+ state.k1[0][1] = (byte)(state.counter_hi >> 0);
+ state.k1[1][1] = (byte)(state.counter_hi >> 8);
+ state.k1[2][1] = (byte)(state.counter_hi >> 16);
+ state.k1[3][1] = (byte)(state.counter_hi >> 24);
+
+ for(j=0; j<4; j++){
+ for(i=0; i<4; i++){
+ state.k1[0][0] = (byte)(state.counter_lo >> 0);
+ state.k1[1][0] = (byte)(state.counter_lo >> 8);
+ state.k1[2][0] = (byte)(state.counter_lo >> 16);
+ state.k1[3][0] = (byte)(state.counter_lo >> 24);
+ state.tab[i][j] = aes(state.tab[i][j], state.k1);
+ state.tab[i][j] = aes(state.tab[i][j], state.k2);
+ state.counter_lo++;
+
+ if (state.counter_lo == 0){
+ state.counter_hi++;
+ state.k1[0][1] = (byte)(state.counter_hi >> 0);
+ state.k1[1][1] = (byte)(state.counter_hi >> 8);
+ state.k1[2][1] = (byte)(state.counter_hi >> 16);
+ state.k1[3][1] = (byte)(state.counter_hi >> 24);
+ }
+ }
+ }
+ }
+
+ private void BigShiftRows(){
+ byte tmp[][][] = new byte[4][4][4];
+ int m;
+
+ for(int i = 1; i < 4; i++) {
+ for(int j = 0; j < 4; j++){
+ m = (j + i) % 4;
+ for(int k = 0; k < 4; k++){
+ for(int l = 0; l < 4; l++){
+ tmp[j][k][l] = state.tab[i][m][k][l];
+ }
+ }
+ }
+
+ for(int j = 0; j < 4; j++) {
+ for(int k = 0; k < 4; k++){
+ for(int l = 0; l < 4; l++){
+ state.tab[i][j][k][l] = tmp[j][k][l];
+ }
+ }
+ }
+ }
+ }
+
+ private byte[] Mix4bytes(short a, short b, short c, short d){
+ /* Mix four bytes in a linear way */
+ byte field[] = new byte[4];
+
+ field[0] = (byte)(mul((short)2, a)^mul((short)3, b)^c^d);
+ field[1] = (byte)(mul((short)2, b)^mul((short)3, c)^d^a);
+ field[2] = (byte)(mul((short)2, c)^mul((short)3, d)^a^b);
+ field[3] = (byte)(mul((short)2, d)^mul((short)3, a)^b^c);
+
+ return field;
+ }
+
+ private void BigMixColumns(){
+ int i,j,k;
+ byte tmp[];
+
+ for(i=0; i<4; i++){
+ for(j=0; j<4; j++){
+ for(k=0; k<4; k++){
+ tmp=Mix4bytes(byteToShort(state.tab[0][i][j][k])
+ , byteToShort(state.tab[1][i][j][k])
+ , byteToShort(state.tab[2][i][j][k])
+ , byteToShort(state.tab[3][i][j][k]));
+
+ state.tab[0][i][j][k]=tmp[0];
+ state.tab[1][i][j][k]=tmp[1];
+ state.tab[2][i][j][k]=tmp[2];
+ state.tab[3][i][j][k]=tmp[3];
+ }
+ }
+ }
+ }
+
+ private void BigFinal(){
+ int i,j,k;
+
+ if (state.cv_size == 512){
+ for(i=0; i<4; i++){
+ for(k=0; k<4; k++){
+ for(j=0; j<4; j++){
+ state.tab[i][0][j][k] =
+ (byte)(byteToShort(state.tab_backup[i][0][j][k]) ^
+ byteToShort(state.tab_backup[i][1][j][k]) ^
+ byteToShort(state.tab_backup[i][2][j][k]) ^
+ byteToShort(state.tab_backup[i][3][j][k]) ^
+ byteToShort(state.tab[i][0][j][k]) ^
+ byteToShort(state.tab[i][1][j][k]) ^
+ byteToShort(state.tab[i][2][j][k]) ^
+ byteToShort(state.tab[i][3][j][k])) ;
+ }
+ }
+ }
+ }else{
+ for(i=0; i<4; i++){
+ for(k=0; k<4; k++){
+ for(j=0; j<4; j++){
+ state.tab[i][0][j][k] =
+ (byte)(byteToShort(state.tab_backup[i][0][j][k]) ^
+ byteToShort(state.tab_backup[i][2][j][k]) ^
+ byteToShort(state.tab[i][0][j][k]) ^
+ byteToShort(state.tab[i][2][j][k]));
+ }
+ }
+ }
+
+ for(i=0; i<4; i++){
+ for(k=0; k<4; k++){
+ for(j=0; j<4; j++){
+ state.tab[i][1][j][k] =
+ (byte)(byteToShort(state.tab_backup[i][1][j][k]) ^
+ byteToShort(state.tab_backup[i][3][j][k]) ^
+ byteToShort(state.tab[i][1][j][k]) ^
+ byteToShort(state.tab[i][3][j][k]));
+ }
+ }
+ }
+ }
+ }
+
+ private void Compress(){
+ Backup();
+
+ state.counter_hi = state.messlenhi;
+ state.counter_lo = state.messlenlo;
+
+ for(int i=0; i 256 - 16 - 2)
+ {
+ //padding with "0"
+ while (state.index < 256)
+ {
+ Push((byte)0);
+ }
+ Compress();
+ state.index = (short)(state.cv_size/8);
+ //no message bit in next block
+ nFinalPadding = 1;
+ }
+ //padding last block
+ while (state.index < 256 - 16 - 2)
+ {
+ Push((byte)0);
+ }
+ //HSIZE (2 bytes)
+ Push((byte)state.hashbitlen);
+ Push((byte)(state.hashbitlen >> 8));
+ //message length (8 bytes)
+ Push((byte)(state.messlenlo >> 0));
+ Push((byte)(state.messlenlo >> 8));
+ Push((byte)(state.messlenlo >> 16));
+ Push((byte)(state.messlenlo >> 24));
+ Push((byte)(state.messlenhi >> 0));
+ Push((byte)(state.messlenhi >> 8));
+ Push((byte)(state.messlenhi >> 16));
+ Push((byte)(state.messlenhi >> 24));
+
+ //High 64 bits of counter set to 0
+ while (state.index < 256)
+ {
+ Push((byte)0);
+ }
+ if (nFinalPadding != 0)
+ {
+ state.messlenhi = 0;
+ state.messlenlo = 0;
+ }
+ Compress();
+ }
+
+ private int Final(){
+ int i;
+
+ int MASK_AND[] ={
+ 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE
+ };
+
+ if (state == null){
+ return STATE_NULL;
+ }
+
+ if (state.computed != 0){
+ return FAIL;
+ }
+
+ Pad();
+
+ /* output truncated hash value */
+ state.index = 0;
+ for(i=0; i<((state.hashbitlen + 7)/8); i++){
+ hashval[i] = Pop();
+ }
+
+ //last byte truncation
+ hashval[i-1] &= MASK_AND[state.hashbitlen % 8];
+
+ //clean up
+ state.index = 0;
+
+ for (i=0; i<256; i++){
+ Push((byte)0);
+ }
+
+ state.computed = 1;
+
+ return SUCCESS;
+ }
+
+ private int Hash(int hashbitlen, byte[] data){
+ int F;
+ F = Init(hashbitlen);
+
+ if(F != SUCCESS)
+ return F;
+
+ F = Update(data);
+
+ if(F != SUCCESS)
+ return F;
+
+ return Final();
+ }
+
+ private void setSalt(byte[] salt){
+ if(salt != null && salt.length == 16){
+ //salt low 64 bits
+ state.k2[0][0] = salt[0];
+ state.k2[1][0] = salt[1];
+ state.k2[2][0] = salt[2];
+ state.k2[3][0] = salt[3];
+ state.k2[0][1] = salt[4];
+ state.k2[1][1] = salt[5];
+ state.k2[2][1] = salt[6];
+ state.k2[3][1] = salt[7];
+ //salt high 64 bits
+ state.k2[0][2] = salt[8];
+ state.k2[1][2] = salt[9];
+ state.k2[2][2] = salt[10];
+ state.k2[3][2] = salt[11];
+ state.k2[0][3] = salt[12];
+ state.k2[1][3] = salt[13];
+ state.k2[2][3] = salt[14];
+ state.k2[3][3] = salt[15];
+ }
+ }
+
+ private byte[] hexStrToByteField(String hexStr){
+ if(hexStr.length()%2==0){
+ byte [] bytes = new byte[hexStr.length()/2];
+ int i,j;
+
+ try{
+ for(i=0,j=0;j> 2] >> (3 - (i & 3))) & 1);
+
+ /**
+ * S box layer, each constant bit selects one Sbox from S0 and S1.
+ */
+ for (i = 0; i < 256; i++) {
+ /**
+ * Constant bits are used to determine which Sbox to use.
+ */
+ tem[i] = S[roundconstant_expanded[i]][state.A[i]];
+ }
+
+ /**
+ * L Layer
+ */
+ for (i = 0; i < 256; i = i + 2) {
+ tem[i + 1] ^= (((tem[i] << 1) & 0x00FF) ^ (tem[i] >> 3) ^ ((tem[i] >> 2) & 2)) & 0x00f;
+ tem[i] ^= (((tem[i + 1] << 1) & 0x00FF) ^ (tem[i + 1] >> 3) ^ ((tem[i + 1] >> 2) & 2)) & 0x00f;
+ }
+
+ /*
+ * The following is the permuation layer P_8$ initial swap Pi_8
+ */
+ for (i = 0; i < 256; i = i + 4) {
+ t = tem[i + 2];
+ tem[i + 2] = tem[i + 3];
+ tem[i + 3] = t;
+ }
+
+ /**
+ * permutation P'_8
+ */
+ for (i = 0; i < 128; i = i + 1) {
+ state.A[i] = tem[i << 1];
+ state.A[i + 128] = tem[(i << 1) + 1];
+ }
+ /**
+ * final swap Phi_8
+ */
+ for (i = 128; i < 256; i = i + 2) {
+ t = state.A[i];
+ state.A[i] = state.A[i + 1];
+ state.A[i + 1] = t;
+ }
+ }
+
+ /**
+ * Last half round of R8, only Sbox layer in this last half round.
+ */
+ void last_half_round_R8(JHHashState state) {
+ int i;
+ /**
+ * The round constant expanded into 256 1-bit element.
+ */
+ byte roundconstant_expanded[] = new byte[256];
+ /**
+ * Expands the round constant into one-bit element.
+ */
+ for (i = 0; i < 256; i++) {
+ roundconstant_expanded[i] = (byte) ((state.roundconstant[i >> 2] >> (3 - (i & 3))) & 1);
+ }
+
+ /**
+ * S box layer
+ */
+ for (i = 0; i < 256; i++) {
+ /**
+ * Constant bits are used to determine which Sbox to use.
+ */
+ state.A[i] = S[roundconstant_expanded[i]][state.A[i]];
+ }
+
+ }
+
+ /**
+ * The following function generates the next round constant from the current round constant; R6 is used for
+ * generating round constants for E8, and the round constants of R6 is set as 0;
+ */
+ void update_roundconstant(JHHashState state) {
+ int i;
+ byte tem[] = new byte[64], t;
+
+ /**
+ * Sbox layer
+ */
+ for (i = 0; i < 64; i++)
+ tem[i] = S[0][state.roundconstant[i]];
+
+ /**
+ * Linear transformation layer L
+ */
+ for (i = 0; i < 64; i = i + 2) {
+ tem[i + 1] ^= (((tem[i] << 1) & 0x00FF) ^ (tem[i] >> 3) ^ ((tem[i] >> 2) & 2)) & 0x00f;
+ tem[i] ^= (((tem[i + 1] << 1) & 0x00FF) ^ (tem[i + 1] >> 3) ^ ((tem[i + 1] >> 2) & 2)) & 0x00f;
+ }
+
+ /**
+ * The following is the permutation layer P_6
+ */
+
+ /**
+ * initial swap Pi_6
+ */
+ for (i = 0; i < 64; i = i + 4) {
+ t = tem[i + 2];
+ tem[i + 2] = tem[i + 3];
+ tem[i + 3] = t;
+ }
+
+ /**
+ * permutation P'_6
+ */
+ for (i = 0; i < 32; i = i + 1) {
+ state.roundconstant[i] = tem[i << 1];
+ state.roundconstant[i + 32] = tem[(i << 1) + 1];
+ }
+
+ /**
+ * final swap Phi_6
+ */
+ for (i = 32; i < 64; i = i + 2) {
+ t = state.roundconstant[i];
+ state.roundconstant[i] = state.roundconstant[i + 1];
+ state.roundconstant[i + 1] = t;
+ }
+ }
+
+ /**
+ * Bijective function E
+ */
+ void E8(JHHashState state) {
+ int i;
+ byte t0, t1, t2, t3;
+ byte tem[] = new byte[256];
+
+ /**
+ * initial group at the begining of E_8: group the H value into 4-bit elements and store them in A
+ *
+ * t0 is the i-th bit of H t1 is the (i+2^d)-th bit of H t2 is the (i+2*(2^d))-th bit of H t3 is the
+ * (i+3*(2^d))-th bit of H
+ * */
+ for (i = 0; i < 256; i++) {
+ t0 = (byte) ((state.H[i >> 3] >> (7 - (i & 7))) & 1);
+ t1 = (byte) ((state.H[(i + 256) >> 3] >> (7 - (i & 7))) & 1);
+ t2 = (byte) ((state.H[(i + 512) >> 3] >> (7 - (i & 7))) & 1);
+ t3 = (byte) ((state.H[(i + 768) >> 3] >> (7 - (i & 7))) & 1);
+ tem[i] = (byte) ((((t0 << 3) & 0x00FF) | ((t1 << 2) & 0x00FF) | ((t2 << 1) & 0x00FF) | ((t3 << 0) & 0x00FF)) & 0x00FF);
+ }
+
+ for (i = 0; i < 128; i++) {
+ state.A[i << 1] = tem[i];
+ state.A[(i << 1) + 1] = tem[i + 128];
+ }
+
+ /**
+ * 35 rounds
+ */
+ for (i = 0; i < 35; i++) {
+ R8(state);
+ update_roundconstant(state);
+ }
+
+ /**
+ * The final half round with only Sbox layer.
+ */
+ last_half_round_R8(state);
+
+ /**
+ * de-group at the end of E_8: decompose the 4-bit elements of A into the 1024-bit H
+ */
+ for (i = 0; i < 128; i++)
+ state.H[i] = 0;
+
+ for (i = 0; i < 128; i++) {
+ tem[i] = state.A[i << 1];
+ tem[i + 128] = state.A[(i << 1) + 1];
+ }
+
+ for (i = 0; i < 256; i++) {
+ t0 = (byte) ((tem[i] >> 3) & 1);
+ t1 = (byte) ((tem[i] >> 2) & 1);
+ t2 = (byte) ((tem[i] >> 1) & 1);
+ t3 = (byte) ((tem[i] >> 0) & 1);
+
+ state.H[i >> 3] |= t0 << (7 - (i & 7));
+ state.H[(i + 256) >> 3] |= t1 << (7 - (i & 7));
+ state.H[(i + 512) >> 3] |= t2 << (7 - (i & 7));
+ state.H[(i + 768) >> 3] |= t3 << (7 - (i & 7));
+ }
+
+ }
+
+ /**
+ * compression function F8
+ */
+ void F8(JHHashState state) {
+ int i;
+
+ /**
+ * initialize the round constant
+ */
+ if (true)
+
+ for (i = 0; i < 64; i++)
+ state.roundconstant[i] = roundconstant_zero[i];
+ for (i = 0; i < 64; i++)
+ state.H[i] ^= state.buffer[i];
+
+ /**
+ * Bijective function E8
+ */
+ E8(state);
+ /**
+ * Xor the message with the last half of H.
+ */
+ for (i = 0; i < 64; i++)
+ state.H[i + 64] ^= state.buffer[i];
+ }
+
+ public void init(JHHashState state, int hashbitlen) {
+ int i;
+
+ state.hashbitlen = hashbitlen;
+
+ for (i = 0; i < 64; i++)
+ state.buffer[i] = 0;
+ for (i = 0; i < 128; i++)
+ state.H[i] = 0;
+
+ /**
+ * initialize the initial hash value of JH
+ */
+ state.H[1] = (byte) (hashbitlen & 0x00ff);
+ state.H[0] = (byte) ((hashbitlen >> 8) & 0x00ff);
+
+ F8(state);
+ }
+
+ public void update(JHHashState state, byte[] data, long databitlen) {
+ int i;
+
+ state.databitlen = databitlen;
+
+ /**
+ * Compresses the message blocks except the last partial block.
+ */
+ for (i = 0; (i + 512) <= databitlen; i = i + 512) {
+ arrayCopy(state.getBuffer(), (i >> 3), 64, data);
+ F8(state);
+ }
+
+ /**
+ * Storing the partial block into buffer.
+ */
+ if ((databitlen & 0x1ff) > 0) {
+ for (i = 0; i < 64; i++)
+ state.buffer[i] = 0;
+ if ((databitlen & 7) == 0)
+ arrayCopy(state.getBuffer(), (int) ((databitlen >> 9) << 6), (int) (databitlen & 0x1ff) >> 3, data);
+ else
+ arrayCopy(state.getBuffer(), (int) ((databitlen >> 9) << 6), (int) ((databitlen & 0x1ff) >> 3) + 1,
+ data);
+ }
+ }
+
+ /**
+ * Padding the message, truncate the hash value H and obtain the message digest.
+ */
+ public void finalize(JHHashState state, byte hashval[]) {
+ int i;
+
+ if ((state.databitlen & 0x1ff) == 0) {
+ /**
+ * Pad the message when databitlen is multiple of 512 bits, then process the padded block.
+ */
+ for (i = 0; i < 64; i++)
+ state.buffer[i] = 0;
+ state.buffer[0] = (byte) 0x0080;
+ state.buffer[63] = (byte) (state.databitlen & 0x00ff);
+ state.buffer[62] = (byte) ((state.databitlen >> 8) & 0x00ff);
+ state.buffer[61] = (byte) ((state.databitlen >> 16) & 0x00ff);
+ state.buffer[60] = (byte) ((state.databitlen >> 24) & 0x00ff);
+ state.buffer[59] = (byte) ((state.databitlen >> 32) & 0x00ff);
+ state.buffer[58] = (byte) ((state.databitlen >> 40) & 0x00ff);
+ state.buffer[57] = (byte) ((state.databitlen >> 48) & 0x00ff);
+ state.buffer[56] = (byte) ((state.databitlen >> 56) & 0x00ff);
+ F8(state);
+ } else {
+ /**
+ * Pad and processes the partial block.
+ */
+ state.buffer[(int) ((state.databitlen & 0x1ff) >> 3)] |= 1 << (7 - (state.databitlen & 7));
+ F8(state);
+ for (i = 0; i < 64; i++)
+ state.buffer[i] = 0;
+ /**
+ * Precesses the last padded block.
+ */
+ state.buffer[63] = (byte) (state.databitlen & 0x00ff);
+ state.buffer[62] = (byte) ((state.databitlen >> 8) & 0x00ff);
+ state.buffer[61] = (byte) ((state.databitlen >> 16) & 0x00ff);
+ state.buffer[60] = (byte) ((state.databitlen >> 24) & 0x00ff);
+ state.buffer[59] = (byte) ((state.databitlen >> 32) & 0x00ff);
+ state.buffer[58] = (byte) ((state.databitlen >> 40) & 0x00ff);
+ state.buffer[57] = (byte) ((state.databitlen >> 48) & 0x00ff);
+ state.buffer[56] = (byte) ((state.databitlen >> 56) & 0x00ff);
+ F8(state);
+ }
+
+ /**
+ * Trunacting the final hash value to generate the message digest.
+ */
+ if (state.getHashBitlen() == 224)
+ arrayCopy(hashval, 100, 28, state.getH());
+
+ if (state.getHashBitlen() == 256)
+ arrayCopy(hashval, 96, 32, state.getH());
+
+ if (state.getHashBitlen() == 384)
+ arrayCopy(hashval, 80, 48, state.getH());
+
+ if (state.getHashBitlen() == 512)
+ arrayCopy(hashval, 64, 64, state.getH());
+ }
+
+ /**
+ * hash the message
+ */
+ public byte[] hash(int hashbitlen) {
+ this.hashval = new byte[hashbitlen];
+ JHHashState state = new JHHashState(hashbitlen, this.dataLength);
+ if (hashbitlen == 224 || hashbitlen == 256 || hashbitlen == 384 || hashbitlen == 512) {
+ init(state, hashbitlen);
+ update(state, bitSequence, dataLength);
+ finalize(state, hashval);
+ state.setHash(hashval);
+ }
+ return state.getHash();
+ }
+
+ /**
+ * copies an array
+ *
+ * @return
+ */
+ public byte[] arrayCopy(byte[] array, int index, int bytes, byte[] data) {
+ if (array.length >= bytes && data.length >= (index + bytes)) {
+ for (int i = 0; i < bytes; i++) {
+ array[i] = data[index + i];
+ }
+ }
+ return array;
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/JH/JHHashState.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/JH/JHHashState.java
new file mode 100755
index 0000000..3717236
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/JH/JHHashState.java
@@ -0,0 +1,114 @@
+// -----BEGIN DISCLAIMER-----
+/*******************************************************************************
+ * Copyright (c) 2010 JCrypTool team and contributors
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+// -----END DISCLAIMER-----
+package org.jcryptool.visual.sha3candidates.algorithms.JH;
+
+/**
+ * Helper class for JH.
+ *
+ * @author Michael Rupp
+ */
+public class JHHashState {
+
+ /**
+ * the message digest size
+ */
+ protected int hashbitlen;
+ /**
+ * the message size in bits
+ */
+ protected long databitlen;
+ /**
+ * the hash value H; 128 bytes
+ */
+ protected byte H[] = new byte[128];
+ /**
+ * the temporary round value; 256 4-bit elements
+ */
+ protected byte A[] = new byte[256];
+ /**
+ * round constant for one round; 64 4-bit elements
+ */
+ protected byte roundconstant[] = new byte[64];
+ /**
+ * the message block to be hashed; 64 bytes
+ */
+ protected byte buffer[] = new byte[64];
+
+ /**
+ * Array of the final hash value.
+ */
+ protected byte hash[];
+
+ /**
+ * Constructor
+ *
+ * @param hashbitlen sets the hash bitlength.
+ * @param databitlen sets the data bitlength.
+ */
+ public JHHashState(int hashbitlen, long databitlen) {
+ this.hashbitlen = hashbitlen;
+ this.databitlen = databitlen;
+ this.hash = new byte[hashbitlen / 8];
+ }
+
+ /**
+ * Converts a string of the hash value in a array of the hash value.
+ *
+ * @param hashval
+ */
+ public void setHash(byte[] hashval) {
+ for (int i = 0; i < hashbitlen / 8; i++) {
+ hash[i] = hashval[i];
+ }
+ }
+
+ /**
+ * Returns the hash value.
+ *
+ * @return hash value
+ */
+ public byte[] getHash() {
+ return this.hash;
+ }
+
+ /**
+ * Returns the message block to hash (64 bit).
+ *
+ * @return 64 bit message block.
+ */
+ public byte[] getBuffer() {
+ return this.buffer;
+ }
+
+ /**
+ * Returns the hash value H (128 bit).
+ *
+ * @return 128 bit hash value.
+ */
+ public byte[] getH() {
+ return this.H;
+ }
+
+ /**
+ * Returns the hash bitlength of a hashstate.
+ */
+ public int getHashBitlen() {
+ return this.hashbitlen;
+ }
+
+ /**
+ * Sets a hash bitlength of a hashstate.
+ *
+ * @param len could be 224, 256, 384 or 512.
+ */
+ public void setHashBitlen(int len) {
+ this.hashbitlen = len;
+ }
+}
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/JH/package-info.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/JH/package-info.java
new file mode 100755
index 0000000..ebdff5c
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/algorithms/JH/package-info.java
@@ -0,0 +1,8 @@
+/**
+ *
+ */
+/**
+ * @author ZWC
+ *
+ */
+package org.jcryptool.visual.sha3candidates.algorithms.JH;
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/handlers/RestartHandler.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/handlers/RestartHandler.java
new file mode 100755
index 0000000..636430e
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/handlers/RestartHandler.java
@@ -0,0 +1,22 @@
+package org.jcryptool.visual.sha3candidates.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jcryptool.visual.sha3candidates.views.HashingView;
+
+/**
+ * @author Ferit Dogan
+ */
+public class RestartHandler extends AbstractHandler {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if (HandlerUtil.getActivePart(event) instanceof HashingView) {
+ HashingView view = ((HashingView) HandlerUtil.getActivePart(event));
+
+ view.resetView();
+ }
+ return null;
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView.java
new file mode 100755
index 0000000..1ab2673
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView.java
@@ -0,0 +1,800 @@
+package org.jcryptool.visual.sha3candidates.views;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.c32;
+
+import org.bouncycastle.crypto.digests.GOST3411Digest;
+import org.bouncycastle.crypto.digests.MD2Digest;
+import org.bouncycastle.crypto.digests.MD4Digest;
+import org.bouncycastle.crypto.digests.MD5Digest;
+import org.bouncycastle.crypto.digests.RIPEMD160Digest;
+import org.bouncycastle.crypto.digests.SHA1Digest;
+import org.bouncycastle.crypto.digests.SHA256Digest;
+import org.bouncycastle.crypto.digests.SHA512Digest;
+import org.bouncycastle.crypto.digests.SM3Digest;
+import org.bouncycastle.crypto.digests.TigerDigest;
+import org.bouncycastle.crypto.digests.WhirlpoolDigest;
+import org.bouncycastle.jcajce.provider.digest.SHA3;
+import org.bouncycastle.jcajce.provider.digest.Skein;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.swt.SWT;
+///////////////////
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.CloseWindowListener;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.browser.OpenWindowListener;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.browser.StatusTextEvent;
+import org.eclipse.swt.browser.StatusTextListener;
+import org.eclipse.swt.browser.TitleEvent;
+import org.eclipse.swt.browser.TitleListener;
+import org.eclipse.swt.browser.WindowEvent;
+/////////////////////
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.ST;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.core.logging.utils.LogUtil;
+import org.jcryptool.visual.sha3candidates.HashingPlugin;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+import org.jcryptool.visual.sha3candidates.algorithms.ECHO.ECHOAction;
+import org.jcryptool.visual.sha3candidates.algorithms.JH.JHAction;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import static org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Algorithm.IV224;
+////////
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_tab;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_tab0;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_tab1;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_tab2;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_tab3;
+////////////
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+
+public class HashingView extends ViewPart {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.jcryptool.visual.sha3candidates.views.HashingView"; //$NON-NLS-1$
+ private static final int OUTPUT_SEPERATOR = 144;
+
+ private org.jcryptool.visual.sha3candidates.algorithms.HashFunction hash = org.jcryptool.visual.sha3candidates.algorithms.HashFunction.BLAKE224;
+ private String hashInputValueHex = ""; //$NON-NLS-1$
+ private String hashOutputValueHex = ""; //$NON-NLS-1$
+ private String page="file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html";
+ private Browser Hashpage;
+ private Table table;
+ private Table table1;
+ private StyledText styledTextDescription;
+ private StyleRange header;
+ private Text textInput;
+ private Text textHashInput;
+ private Text textOutput;
+ private Text textHashOutput;
+ private StyledText textDifference;
+ private Combo comboHash;
+ private Button btnHexadezimal;
+ private Button btnDezimal;
+ private Button btnBinary;
+ private Button btnChanged;
+ private Button btnUnchanged;
+ private TabFolder tabFolder;
+ private Blake_tab0 blake_tab0;
+ private Blake_tab1 blake_tab1;
+ private Blake_tab2 blake_tab2;
+ private Blake_tab3 blake_tab3;
+ private Blake_Action BLAKE224;
+ /**
+ * The constructor.
+ */
+ public HashingView() {
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ scrolledComposite.setExpandHorizontal(true);
+ scrolledComposite.setExpandVertical(true);
+ scrolledComposite.setBounds(10, 10, 1600, 800);
+ Composite compositeMain = new Composite(scrolledComposite, SWT.NONE);
+ compositeMain.setBounds(10, 10, 1600, 800);
+
+ styledTextDescription = new StyledText(compositeMain, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
+ styledTextDescription.setBounds(10, 10, 400, 50);
+ styledTextDescription.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ styledTextDescription.setSelection(0, 0);
+ }
+ });
+ styledTextDescription.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ styledTextDescription.selectAll();
+ }
+ }
+ });
+ styledTextDescription.setEditable(false);
+ GridData gd_styledTextDescription = new GridData(SWT.FILL, SWT.UP, true, false, 4, 1);
+ gd_styledTextDescription.widthHint = 300;
+ gd_styledTextDescription.heightHint = 60;
+ styledTextDescription.setLayoutData(gd_styledTextDescription);
+ styledTextDescription.setText(Messages.HashingView_0 + Messages.HashingView_1);
+
+
+ Group Hashalgorithm = new Group(compositeMain, SWT.FILL | SWT.H_SCROLL);
+ Hashalgorithm.setBounds(420, 0, 1500, 810);
+ Hashalgorithm.setText("Inside Hash Function");
+
+ tabFolder= new TabFolder(Hashalgorithm, SWT.FILL | SWT.H_SCROLL);
+ tabFolder.setBounds(10, 20, 1480, 800);
+// tabFolder.setVisible(false);
+ Group tabpage0 = new Group(tabFolder, SWT.NONE);
+ tabpage0.setBounds(10, 10, 1470, 800);
+ TabItem tabItem0 = new TabItem(tabFolder, SWT.NONE);
+ tabItem0.setText("Initialization");
+ tabItem0.setControl(tabpage0);
+
+ Group tabpage1 = new Group(tabFolder, SWT.NONE);
+ tabpage1.setBounds(10, 10, 1470, 800);
+ TabItem tabItem1 = new TabItem(tabFolder, SWT.NONE);
+ tabItem1.setText("Compressing");
+ tabItem1.setControl(tabpage1);
+
+ Group tabpage2 = new Group(tabFolder, SWT.NONE);
+ tabpage2.setBounds(10, 20, 1470, 800);
+ TabItem tabItem2 = new TabItem(tabFolder, SWT.NONE);
+ tabItem2.setText("Sigma");
+ tabItem2.setControl(tabpage2);
+
+ Group tabpage3 = new Group(tabFolder, SWT.NONE);
+ tabpage3.setBounds(10, 10, 1470, 800);
+ TabItem tabItem3 = new TabItem(tabFolder, SWT.NONE);
+ tabItem3.setText("Output");
+ tabItem3.setControl(tabpage3);
+
+
+ blake_tab0=new Blake_tab0(tabFolder, tabpage0);
+ blake_tab1=new Blake_tab1(tabFolder, tabpage1);
+ blake_tab3=new Blake_tab3(tabFolder, tabpage3);
+
+ blake_tab0.message3.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ long v16[]=new long[16];
+ for(int i=0;i<8;i++) {
+ v16[i]=IV224[i]&0xffffffffL;
+ }
+ for(int i=0; i<4;i++) {
+ v16[i+8]=((long)(BLAKE224.Algorithm.state.salt32[i]^c32[i]))& 0xffffffffL;
+ }
+ v16[12]=((long)(BLAKE224.Algorithm.state.t32[0] ^ c32[4]) & 0xffffffffL);
+ v16[13]=((long)(BLAKE224.Algorithm.state.t32[0] ^ c32[5]) & 0xffffffffL);
+ v16[14]=((long)(BLAKE224.Algorithm.state.t32[1] ^ c32[6]) & 0xffffffffL);
+ v16[15]=((long)(BLAKE224.Algorithm.state.t32[1] ^ c32[7]) & 0xffffffffL);
+
+ blake_tab1.load(v16, textInput.getText().getBytes());
+// tabItem1.setControl(blake_tab0.message3);
+ tabpage0.setVisible(false);
+ tabpage1.setVisible(true);
+ tabpage1.layout();
+ }
+ });
+
+ blake_tab1.sigma_button.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ blake_tab2=new Blake_tab2(tabFolder, tabpage2);
+ tabpage0.setVisible(false);
+ tabpage1.setVisible(false);
+ tabpage2.setVisible(true);
+ tabpage2.layout();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ blake_tab1.SaltButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e){
+ if(blake_tab1.round_num>=14){
+ tabItem3.setText("Hash output");
+ blake_tab3.load(blake_tab1.v16_output, textHashOutput.getText());
+ for(int i=0; i<4; i++){
+ blake_tab3.s4_value[i].setText("0x"+ Integer.toHexString(BLAKE224.Algorithm.state.salt32[i]));
+ }
+ blake_tab3.load_v16();
+ tabpage0.setVisible(false);
+ tabpage1.setVisible(false);
+ tabpage2.setVisible(false);
+ tabpage3.setVisible(true);
+ tabpage3.layout();
+ }
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ Group Hashinput = new Group(compositeMain, SWT.NONE);
+ Hashinput.setBounds(10, 70, 400, 650);
+ Hashinput.setLayout(new GridLayout(1, false));
+ Hashinput.setText("Hash Input");
+
+ Group grpHashfunction = new Group(Hashinput, SWT.NONE);
+ grpHashfunction.setLayout(new GridLayout(1, false));
+ grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ grpHashfunction.setText("Select a hash function");
+
+ comboHash = new Combo(grpHashfunction, SWT.READ_ONLY);
+ comboHash.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (!textInput.getText().isEmpty()) {
+ hashInputValueHex = computeHash(comboHash.getText(), textInput.getText(), null, textHashInput, Hashpage);
+ blake_tab0.create_m(BLAKE224,textInput.getText(), textOutput.getText());
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hashOutputValueHex = computeHash(comboHash.getText(), textInput.getText(), textOutput.getText(), textHashOutput, Hashpage);
+ blake_tab0.create_m(BLAKE224, textInput.getText(), textOutput.getText());
+ }
+
+
+ }
+ });
+ comboHash.setItems(new String[] {
+ "ECHO (224 bits)", "ECHO (256 bits)", "ECHO (384 bits)", "ECHO (512 bits)", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "JH (224 bits)", "JH (256 bits)", "JH (384 bits)", "JH (512 bits)",
+ "BLAKE (224 bits)", "BLAKE (256 bits)", "BLAKE (384 bits)", "BLAKE (512 bits)",
+ "SHA-2 (256 bits)", "SHA-2 (512 bits)", "SHA-3 (224 bits)", "SHA-3 (256 bits)", "SHA-3 (384 bits)", "SHA-3 (512 bits)", "SKEIN-256 (256 bits)", "SKEIN-512 (512 bits)", "SKEIN-1024 (1024 bits)", "SM3 (256 bits)", "RIPEMD-160 (160 bits)", "TIGER (192 bits)", "GOST3411 (256 bits)", "WHIRLPOOL (512 bits)" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$
+ comboHash.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ comboHash.select(0);
+
+ Group grpTypeHash = new Group(Hashinput, SWT.NONE);
+ grpTypeHash.setLayout(new GridLayout(3, false));
+ grpTypeHash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+ grpTypeHash.setText(Messages.HashingView_3);
+
+ btnHexadezimal = new Button(grpTypeHash, SWT.RADIO);
+ btnHexadezimal.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hashInputValueHex.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hashOutputValueHex.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+ }
+ });
+ btnHexadezimal.setSelection(true);
+ btnHexadezimal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnHexadezimal.setText(Messages.HashingView_4);
+
+ btnDezimal = new Button(grpTypeHash, SWT.RADIO);
+ btnDezimal.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hexToDecimal(hashInputValueHex);
+ hash = hash.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hexToDecimal(hashOutputValueHex);
+ hash = hash.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+ }
+ });
+ btnDezimal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnDezimal.setText(Messages.HashingView_5);
+
+ btnBinary = new Button(grpTypeHash, SWT.RADIO);
+ btnBinary.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hexToBinary(hashInputValueHex);
+ hash = hash.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hexToBinary(hashOutputValueHex);
+ hash = hash.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+
+ }
+ });
+ btnBinary.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnBinary.setText(Messages.HashingView_6);
+
+
+ Group grpInput = new Group(Hashinput, SWT.NONE);
+ grpInput.setLayout(new GridLayout(1, false));
+ grpInput.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 18));
+ grpInput.setText("Input String");
+
+ textInput = new Text(grpInput, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
+ textInput.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textInput.setSelection(0, 0);
+ }
+ });
+ textInput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textInput.selectAll();
+ }
+ }
+ });
+ textInput.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (!textInput.getText().isEmpty()) {
+ hashInputValueHex = computeHash(comboHash.getText(), textInput.getText(), null, textHashInput, Hashpage);
+ hashOutputValueHex = computeHash(comboHash.getText(), textInput.getText(), textOutput.getText(), textHashOutput, Hashpage);
+ blake_tab0.create_m(BLAKE224, textInput.getText(), textOutput.getText());
+ } else {
+ textHashInput.setText(""); //$NON-NLS-1$
+ }
+
+ }
+ });
+ GridData gd_textInput = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
+ gd_textInput.heightHint = 90;
+ textInput.setLayoutData(gd_textInput);
+
+
+ Group grpOutput = new Group(Hashinput, SWT.NONE);
+ grpOutput.setLayout(new GridLayout(1, false));
+ grpOutput.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ grpOutput.setText("Salt");
+
+ textOutput = new Text(grpOutput, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
+ textOutput.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textOutput.setSelection(0, 0);
+ }
+ });
+ textOutput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textOutput.selectAll();
+ }
+ }
+ });
+ textOutput.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (!textOutput.getText().isEmpty()) {
+ hashOutputValueHex = computeHash(comboHash.getText(), textInput.getText(), textOutput.getText(), textHashOutput, Hashpage);
+ blake_tab0.create_m(BLAKE224, textInput.getText(), textOutput.getText());
+ } else {
+ textHashOutput.setText(""); //$NON-NLS-1$
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ GridData gd_textOutput = new GridData(SWT.FILL, SWT.UP, true, true, 1, 1);
+ gd_textOutput.heightHint = 90;
+ textOutput.setLayoutData(gd_textOutput);
+
+
+
+ Group grpHashInput = new Group(compositeMain, SWT.NONE);
+ grpHashInput.setBounds(10, 730, 400, 60);
+ grpHashInput.setLayout(new GridLayout(1, false));
+ grpHashInput.setText(Messages.HashingView_10);
+
+ textHashInput = new Text(grpHashInput, SWT.BORDER | SWT.READ_ONLY);
+ textHashInput.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL)); //$NON-NLS-1$
+ textHashInput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textHashInput.selectAll();
+ }
+ }
+ });
+ textHashInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Group grpHashOutput = new Group(compositeMain, SWT.NONE);
+ grpHashOutput.setBounds(10, 800, 1300, 60);
+ grpHashOutput.setLayout(new GridLayout(4, false));
+ grpHashOutput.setText(Messages.HashingView_8);
+
+ textHashOutput = new Text(grpHashOutput, SWT.BORDER | SWT.READ_ONLY);
+ textHashOutput.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL)); //$NON-NLS-1$
+ textHashOutput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textHashOutput.selectAll();
+ }
+ }
+ });
+ textHashOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+
+ scrolledComposite.setContent(compositeMain);
+
+ scrolledComposite.setMinSize(new Point(1600, 830));
+
+ }
+
+ private String hexToDecimal(String hex) {
+ StringBuilder sb = new StringBuilder();
+ String[] a = hex.toUpperCase().split("(?<=\\G..)"); //$NON-NLS-1$
+
+ for (String s : a) {
+ sb.append(String.format("%3s", (new BigInteger(s, 16)).toString()).replace(' ', '0')); //$NON-NLS-1$
+ }
+
+ return sb.toString();
+ }
+
+ private String hexToBinary(String hex) {
+ String result = new BigInteger(hex, 16).toString(2);
+ switch (hash) {
+ case ECHO224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case JH224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case BLAKE224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case RIPEMD160:
+ result = String.format("%160s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case TIGER:
+ result = String.format("%192s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA3_224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA256:
+ case SHA3_256:
+ case SKEIN_256:
+ case GOST3411:
+ case SM3:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA3_384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA512:
+ case SHA3_512:
+ case SKEIN_512:
+ case WHIRLPOOL:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SKEIN_1024:
+ result = String.format("%1024s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+
+ default:
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void setFocus() {
+ textOutput.setFocus();
+ }
+
+ public void resetView() {
+ styledTextDescription.setText(Messages.HashingView_0 + Messages.HashingView_1);
+ styledTextDescription.setStyleRange(header);
+
+ comboHash.select(0);
+ btnHexadezimal.setSelection(true);
+ btnDezimal.setSelection(false);
+ btnBinary.setSelection(false);
+
+ textInput.setText(""); //$NON-NLS-1$
+ textHashInput.setText(""); //$NON-NLS-1$
+ textOutput.setText(""); //$NON-NLS-1$
+ textHashOutput.setText(""); //$NON-NLS-1$
+ textDifference.setText(""); //$NON-NLS-1$
+ Hashpage.setUrl("");
+
+ }
+
+ private String computeHash(String hashName, String inputText, String saltText, Text hashText, Browser hashpage) {
+ hash = hash.getName(hashName);
+ byte[] digest = null;
+ switch (hash) {
+ case ECHO224:
+ ECHOAction echo224 = new ECHOAction();
+ digest=echo224.run(224, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case ECHO256:
+ ECHOAction echo256 = new ECHOAction();
+ digest=echo256.run(256, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case ECHO384:
+ ECHOAction echo384 = new ECHOAction();
+ digest=echo384.run(384, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case ECHO512:
+ ECHOAction echo512= new ECHOAction();
+ digest=echo512.run(512, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case JH224:
+ JHAction JH224 = new JHAction();
+ digest=JH224.run(224, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+ case JH256:
+ JHAction JH256 = new JHAction();
+ digest=JH256.run(256, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+
+ case JH384:
+ JHAction JH384 = new JHAction();
+ digest=JH384.run(384, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+
+ case JH512:
+ JHAction JH512= new JHAction();
+ digest=JH512.run(512, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+ case BLAKE224:
+ BLAKE224= new Blake_Action();
+ if(saltText==null) {
+ digest=BLAKE224.run(224, inputText);
+ } else if(saltText.length()!=32){
+ String salt_extend=saltText;
+ for(int i=0; i<32-saltText.length();i++){
+ salt_extend="0"+salt_extend;
+ }
+ digest=BLAKE224.run(224, inputText, salt_extend);
+ }
+ break;
+ case BLAKE256:
+ Blake_Action BLAKE256 = new Blake_Action();
+ if(saltText==null) {
+ digest=BLAKE256.run(256, inputText);
+ } else if(saltText.length()!=32){
+ digest=BLAKE256.run(256, inputText);
+ hashText.setText("salt must be a 32 character string!!!");
+ return "salt must be a 32 character string!!!";
+ } else {
+ digest=BLAKE256.run(256, inputText, saltText);
+ }
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+
+ case BLAKE384:
+ Blake_Action BLAKE384 = new Blake_Action();
+ digest=BLAKE384.run(384, inputText, saltText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case BLAKE512:
+ Blake_Action BLAKE512= new Blake_Action();
+ digest=BLAKE512.run(512, inputText, saltText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case SHA256:
+ SHA256Digest sha256 = new SHA256Digest();
+ sha256.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha256.getDigestSize()];
+ sha256.doFinal(digest, 0);
+
+ break;
+ case SHA512:
+ SHA512Digest sha512 = new SHA512Digest();
+ sha512.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha512.getDigestSize()];
+ sha512.doFinal(digest, 0);
+
+ break;
+ case SHA3_224:
+ SHA3.Digest224 sha3_224 = new SHA3.Digest224();
+ sha3_224.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_224.getDigestLength()];
+ digest = sha3_224.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SHA3_256:
+ SHA3.Digest256 sha3_256 = new SHA3.Digest256();
+ sha3_256.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_256.getDigestLength()];
+ digest = sha3_256.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SHA3_384:
+ SHA3.Digest384 sha3_384 = new SHA3.Digest384();
+ sha3_384.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_384.getDigestLength()];
+ digest = sha3_384.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SHA3_512:
+ SHA3.Digest512 sha3_512 = new SHA3.Digest512();
+ sha3_512.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_512.getDigestLength()];
+ digest = sha3_512.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SKEIN_256:
+ Skein.Digest_256_256 skein_256 = new Skein.Digest_256_256();
+ skein_256.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[skein_256.getDigestLength()];
+ digest = skein_256.digest();
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/SkeinTutorial.html");
+
+ break;
+ case SKEIN_512:
+ Skein.Digest_512_512 skein_512 = new Skein.Digest_512_512();
+ skein_512.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[skein_512.getDigestLength()];
+ digest = skein_512.digest();
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/SkeinTutorial.html");
+
+ break;
+ case SKEIN_1024:
+ Skein.Digest_1024_1024 skein_1024 = new Skein.Digest_1024_1024();
+ skein_1024.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[skein_1024.getDigestLength()];
+ digest = skein_1024.digest();
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/SkeinTutorial.html");
+
+ break;
+ case RIPEMD160:
+ RIPEMD160Digest ripemd160 = new RIPEMD160Digest();
+ ripemd160.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[ripemd160.getDigestSize()];
+ ripemd160.doFinal(digest, 0);
+
+ break;
+ case SM3:
+ SM3Digest sm3 = new SM3Digest();
+ sm3.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sm3.getDigestSize()];
+ sm3.doFinal(digest, 0);
+
+ break;
+ case TIGER:
+ TigerDigest tiger = new TigerDigest();
+ tiger.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[tiger.getDigestSize()];
+ tiger.doFinal(digest, 0);
+
+ break;
+ case GOST3411:
+ GOST3411Digest gost3411 = new GOST3411Digest();
+ gost3411.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[gost3411.getDigestSize()];
+ gost3411.doFinal(digest, 0);
+
+ break;
+ case WHIRLPOOL:
+ WhirlpoolDigest whirlpool = new WhirlpoolDigest();
+ whirlpool.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[whirlpool.getDigestSize()];
+ whirlpool.doFinal(digest, 0);
+
+ break;
+ default:
+ break;
+ }
+
+ String hashHexValue = new String(Hex.encode(digest));
+ if (btnHexadezimal.getSelection()) {
+ String hashValue = hashHexValue.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ hashText.setText(hashValue);
+ } else if (btnDezimal.getSelection()) {
+ String hashValue = hexToDecimal(hashHexValue);
+ hashValue = hashValue.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ hashText.setText(hashValue);
+ } else if (btnBinary.getSelection()) {
+ String hashValue = hexToBinary(hashHexValue);
+ hashValue = hashValue.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ hashText.setText(hashValue);
+ }
+
+ return hashHexValue;
+ }
+
+
+
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView2_origin.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView2_origin.java
new file mode 100755
index 0000000..20e6924
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView2_origin.java
@@ -0,0 +1,1044 @@
+package org.jcryptool.visual.sha3candidates.views;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.bouncycastle.crypto.digests.GOST3411Digest;
+import org.bouncycastle.crypto.digests.MD2Digest;
+import org.bouncycastle.crypto.digests.MD4Digest;
+import org.bouncycastle.crypto.digests.MD5Digest;
+import org.bouncycastle.crypto.digests.RIPEMD160Digest;
+import org.bouncycastle.crypto.digests.SHA1Digest;
+import org.bouncycastle.crypto.digests.SHA256Digest;
+import org.bouncycastle.crypto.digests.SHA512Digest;
+import org.bouncycastle.crypto.digests.SM3Digest;
+import org.bouncycastle.crypto.digests.TigerDigest;
+import org.bouncycastle.crypto.digests.WhirlpoolDigest;
+import org.bouncycastle.jcajce.provider.digest.SHA3;
+import org.bouncycastle.jcajce.provider.digest.Skein;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.swt.SWT;
+///////////////////
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.CloseWindowListener;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.browser.OpenWindowListener;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.browser.StatusTextEvent;
+import org.eclipse.swt.browser.StatusTextListener;
+import org.eclipse.swt.browser.TitleEvent;
+import org.eclipse.swt.browser.TitleListener;
+import org.eclipse.swt.browser.WindowEvent;
+/////////////////////
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.ST;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.core.logging.utils.LogUtil;
+import org.jcryptool.visual.sha3candidates.HashingPlugin;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+import org.jcryptool.visual.sha3candidates.algorithms.ECHO.ECHOAction;
+import org.jcryptool.visual.sha3candidates.algorithms.JH.JHAction;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+
+public class HashingView2_origin extends ViewPart {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.jcryptool.visual.sha3candidates.views.HashingView"; //$NON-NLS-1$
+ private static final int OUTPUT_SEPERATOR = 144;
+
+ private org.jcryptool.visual.sha3candidates.algorithms.HashFunction hash = org.jcryptool.visual.sha3candidates.algorithms.HashFunction.ECHO224;
+ private String hashInputValueHex = ""; //$NON-NLS-1$
+ private String hashOutputValueHex = ""; //$NON-NLS-1$
+ private String page="file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html";
+ private Browser Hashpage;
+ private Table table;
+ private Table table1;
+ private StyledText styledTextDescription;
+ private StyleRange header;
+ private Text textInput;
+ private Text textHashInput;
+ private Text textOutput;
+ private Text textHashOutput;
+ private StyledText textDifference;
+ private Combo comboHash;
+ private Button btnHexadezimal;
+ private Button btnDezimal;
+ private Button btnBinary;
+ private Button btnChanged;
+ private Button btnUnchanged;
+ private Blake_Action BLAKE224;
+ private TabFolder tabFolder;
+
+ /**
+ * The constructor.
+ */
+ public HashingView2_origin() {
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ scrolledComposite.setExpandHorizontal(true);
+ scrolledComposite.setExpandVertical(true);
+ scrolledComposite.setBounds(10, 10, 639, 410);
+ Composite compositeMain = new Composite(scrolledComposite, SWT.NONE);
+//////// compositeMain.setLayout(new GridLayout(2, false));
+ compositeMain.setLayout(new GridLayout(4, false));
+ compositeMain.setBounds(10, 10, 600, 400);
+
+ styledTextDescription = new StyledText(compositeMain, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
+ styledTextDescription.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ styledTextDescription.setSelection(0, 0);
+ }
+ });
+ styledTextDescription.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ styledTextDescription.selectAll();
+ }
+ }
+ });
+ styledTextDescription.setEditable(false);
+ GridData gd_styledTextDescription = new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1);
+ gd_styledTextDescription.widthHint = 300;
+ gd_styledTextDescription.heightHint = 60;
+ styledTextDescription.setLayoutData(gd_styledTextDescription);
+ styledTextDescription.setText(Messages.HashingView_0 + Messages.HashingView_1);
+
+ header = new StyleRange();
+ header.start = 0;
+ header.length = Messages.HashingView_0.length();
+ header.fontStyle = SWT.BOLD;
+ styledTextDescription.setStyleRange(header);
+
+ Menu menu_1 = new Menu(styledTextDescription);
+ styledTextDescription.setMenu(menu_1);
+
+ MenuItem mntmCopy_1 = new MenuItem(menu_1, SWT.NONE);
+ mntmCopy_1.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ styledTextDescription.copy();
+ }
+ });
+ mntmCopy_1.setText(Messages.HashingView_mntmCopy_text);
+
+ MenuItem menuItem_1 = new MenuItem(menu_1, SWT.SEPARATOR);
+
+ MenuItem mntmSelectAll_1 = new MenuItem(menu_1, SWT.NONE);
+ mntmSelectAll_1.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ styledTextDescription.selectAll();
+ }
+ });
+ mntmSelectAll_1.setText(Messages.HashingView_mntmSelectAll_text);
+
+ Group Hashinput = new Group(compositeMain, SWT.NONE);
+////////grpHashfunction.setLayout(new GridLayout(1, false));
+ Hashinput.setLayout(new GridLayout(1, false));
+////////grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ Hashinput.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 10));
+ Hashinput.setText("Hash Input");
+
+ Group grpHashfunction = new Group(Hashinput, SWT.NONE);
+//////// grpHashfunction.setLayout(new GridLayout(1, false));
+ grpHashfunction.setLayout(new GridLayout(1, false));
+//////// grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ grpHashfunction.setText(Messages.HashingView_2);
+
+ Group grpHashalgorithm = new Group(compositeMain, SWT.NONE);
+ grpHashalgorithm.setLayout(new GridLayout(1, false));
+ grpHashalgorithm.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 3, 10));
+ grpHashalgorithm.setText("Hash Algorithm");
+
+ tabFolder = new TabFolder(grpHashalgorithm, SWT.NONE);
+ tabFolder.setLayout(new GridLayout(10, true));
+ tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ TabItem tabItem1 = new TabItem(tabFolder, SWT.NONE);
+ tabItem1.setText("ÊôÐÔ±êÇ©1");
+ TabItem tabItem2 = new TabItem(tabFolder, SWT.NONE);
+ tabItem2.setText("ÊôÐÔ±êÇ©2");
+
+ Group tabpage1 = new Group(tabFolder, SWT.NONE);
+ tabpage1.setLayout(new GridLayout(1, true));
+ tabItem1.setControl(tabpage1);
+ Hashpage = new Browser(tabpage1, SWT.NONE);
+ Hashpage.setLayout(new FillLayout());
+ Hashpage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ Hashpage.setUrl(page);
+
+
+ Group tabpage2 = new Group(tabFolder, SWT.NONE);
+ tabpage2.setLayout(new GridLayout(10, true));
+ tabItem2.setControl(tabpage2);
+
+ table1 = new Table(tabpage2, SWT.BORDER | SWT.FULL_SELECTION);
+ table1.setLayoutData(new GridData(SWT.LEFT, SWT.UP, true, true, 1, 1));
+ table1.setHeaderVisible(true);
+ table1.setLinesVisible(true);
+ TableColumn tc1[] = new TableColumn[2];
+ tc1[0]=new TableColumn(table1, SWT.CENTER);
+ tc1[0].setWidth(40);
+ tc1[0].setResizable(true);
+ tc1[0].setText("hhhhhh");
+ tc1[1] = new TableColumn(table1, SWT.CENTER);
+ tc1[1].setWidth(100);
+ tc1[1].setResizable(true);
+ tc1[1].setText("valueeeeeeeeeeee");
+ TableItem item[]= new TableItem[8];
+ for (int col = 0; col < 8 ; col++) {
+ item[col]= new TableItem(table1, SWT.NONE);
+ }
+
+
+ table = new Table(tabpage2, SWT.BORDER | SWT.FULL_SELECTION);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setLayoutData(new GridData(SWT.LEFT, SWT.UP, true, true, 1, 1));
+ TableColumn tc[] = new TableColumn[2];
+ tc[0]=new TableColumn(table, SWT.CENTER);
+ tc[0].setWidth(40);
+ tc[0].setResizable(true);
+ tc[0].setText("h");
+ tc[1] = new TableColumn(table, SWT.CENTER);
+ tc[1].setWidth(100);
+ tc[1].setResizable(true);
+ tc[1].setText("value");
+ TableItem item1[]= new TableItem[8];
+ for (int col = 0; col < 8 ; col++) {
+ item1[col]= new TableItem(table, SWT.NONE);
+ }
+
+
+
+
+ comboHash = new Combo(grpHashfunction, SWT.READ_ONLY);
+ comboHash.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (!textInput.getText().isEmpty()) {
+ hashInputValueHex = computeHash(comboHash.getText(), textInput.getText(), textHashInput, Hashpage, item);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hashOutputValueHex = computeHash(comboHash.getText(), textOutput.getText(), textHashOutput, Hashpage, item);
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+ computeDifference();
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ comboHash
+ .setItems(new String[] {
+ "ECHO (224 bits)", "ECHO (256 bits)", "ECHO (384 bits)", "ECHO (512 bits)", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "JH (224 bits)", "JH (256 bits)", "JH (384 bits)", "JH (512 bits)",
+ "BLAKE (224 bits)", "BLAKE (256 bits)", "BLAKE (384 bits)", "BLAKE (512 bits)",
+ "SHA-2 (256 bits)", "SHA-2 (512 bits)", "SHA-3 (224 bits)", "SHA-3 (256 bits)", "SHA-3 (384 bits)", "SHA-3 (512 bits)", "SKEIN-256 (256 bits)", "SKEIN-512 (512 bits)", "SKEIN-1024 (1024 bits)", "SM3 (256 bits)", "RIPEMD-160 (160 bits)", "TIGER (192 bits)", "GOST3411 (256 bits)", "WHIRLPOOL (512 bits)" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$
+ comboHash.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ comboHash.select(0);
+
+ Group grpTypeHash = new Group(Hashinput, SWT.NONE);
+ grpTypeHash.setLayout(new GridLayout(3, false));
+ grpTypeHash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+ grpTypeHash.setText(Messages.HashingView_3);
+
+ btnHexadezimal = new Button(grpTypeHash, SWT.RADIO);
+ btnHexadezimal.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hashInputValueHex.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hashOutputValueHex.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+ }
+ });
+ btnHexadezimal.setSelection(true);
+ btnHexadezimal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnHexadezimal.setText(Messages.HashingView_4);
+
+ btnDezimal = new Button(grpTypeHash, SWT.RADIO);
+ btnDezimal.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hexToDecimal(hashInputValueHex);
+ hash = hash.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hexToDecimal(hashOutputValueHex);
+ hash = hash.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+ }
+ });
+ btnDezimal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnDezimal.setText(Messages.HashingView_5);
+
+ btnBinary = new Button(grpTypeHash, SWT.RADIO);
+ btnBinary.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hexToBinary(hashInputValueHex);
+ hash = hash.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hexToBinary(hashOutputValueHex);
+ hash = hash.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+
+ }
+ });
+ btnBinary.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnBinary.setText(Messages.HashingView_6);
+
+
+ Group grpInput = new Group(Hashinput, SWT.NONE);
+ grpInput.setLayout(new GridLayout(1, false));
+ grpInput.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 4, 2));
+ grpInput.setText(Messages.HashingView_7);
+
+ textInput = new Text(grpInput, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
+ textInput.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textInput.setSelection(0, 0);
+ }
+ });
+ textInput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textInput.selectAll();
+ }
+ }
+ });
+ textInput.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (!textInput.getText().isEmpty()) {
+ hashInputValueHex = computeHash(comboHash.getText(), textInput.getText(), textHashInput, Hashpage, item);
+ } else {
+ textHashInput.setText(""); //$NON-NLS-1$
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+ computeDifference();
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ GridData gd_textInput = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
+ gd_textInput.heightHint = 90;
+ textInput.setLayoutData(gd_textInput);
+
+
+ Group grpOutput = new Group(Hashinput, SWT.NONE);
+ grpOutput.setLayout(new GridLayout(1, false));
+ grpOutput.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 4, 2));
+ grpOutput.setText(Messages.HashingView_9);
+
+ textOutput = new Text(grpOutput, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
+ textOutput.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textOutput.setSelection(0, 0);
+ }
+ });
+ textOutput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textOutput.selectAll();
+ }
+ }
+ });
+ textOutput.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (!textOutput.getText().isEmpty()) {
+ hashOutputValueHex = computeHash(comboHash.getText(), textOutput.getText(), textHashOutput, Hashpage, item);
+ } else {
+ textHashOutput.setText(""); //$NON-NLS-1$
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+ computeDifference();
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ GridData gd_textOutput = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
+ gd_textOutput.heightHint = 90;
+ textOutput.setLayoutData(gd_textOutput);
+
+ Group grpHashInput = new Group(compositeMain, SWT.NONE);
+ grpHashInput.setLayout(new GridLayout(1, false));
+ grpHashInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1));
+ grpHashInput.setText(Messages.HashingView_10);
+
+ textHashInput = new Text(grpHashInput, SWT.BORDER | SWT.READ_ONLY);
+ textHashInput.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL)); //$NON-NLS-1$
+ textHashInput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textHashInput.selectAll();
+ }
+ }
+ });
+ textHashInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Group grpHashOutput = new Group(compositeMain, SWT.NONE);
+ grpHashOutput.setLayout(new GridLayout(4, false));
+ grpHashOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1));
+ grpHashOutput.setText(Messages.HashingView_8);
+
+ textHashOutput = new Text(grpHashOutput, SWT.BORDER | SWT.READ_ONLY);
+ textHashOutput.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL)); //$NON-NLS-1$
+ textHashOutput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textHashOutput.selectAll();
+ }
+ }
+ });
+ textHashOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Group grpUnterschied = new Group(compositeMain, SWT.NONE);
+ grpUnterschied.setLayout(new GridLayout(4, false));
+ grpUnterschied.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 4, 1));
+ grpUnterschied.setText(Messages.HashingView_11);
+
+ textDifference = new StyledText(grpUnterschied, SWT.BORDER | SWT.FULL_SELECTION | SWT.READ_ONLY | SWT.WRAP
+ | SWT.V_SCROLL);
+ textDifference.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textDifference.setSelection(0, 0);
+ }
+ });
+ textDifference.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textDifference.selectAll();
+ }
+ }
+ });
+ textDifference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 4, 1));
+
+ Menu menu = new Menu(textDifference);
+ textDifference.setMenu(menu);
+
+ MenuItem mntmCopy = new MenuItem(menu, SWT.NONE);
+ mntmCopy.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ textDifference.copy();
+ }
+ });
+ mntmCopy.setText(Messages.HashingView_mntmCopy_text);
+
+ MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
+
+ MenuItem mntmSelectAll = new MenuItem(menu, SWT.NONE);
+ mntmSelectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ textDifference.selectAll();
+ }
+ });
+ mntmSelectAll.setText(Messages.HashingView_mntmSelectAll_text);
+
+ btnUnchanged = new Button(grpUnterschied, SWT.RADIO);
+ btnUnchanged.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ computeDifference();
+ }
+ });
+ btnUnchanged.setSelection(true);
+ btnUnchanged.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+ btnUnchanged.setText(Messages.HashingView_btnUnchanged_text);
+
+ btnChanged = new Button(grpUnterschied, SWT.RADIO);
+ btnChanged.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ computeDifference();
+ }
+ });
+ btnChanged.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+ btnChanged.setText(Messages.HashingView_btnChanged_text);
+ textDifference.invokeAction(ST.CUT);
+ textDifference.invokeAction(ST.COPY);
+ textDifference.invokeAction(ST.PASTE);
+ scrolledComposite.setContent(compositeMain);
+
+ if (System.getProperty("os.name").compareToIgnoreCase("Windows 10") == 0) {
+ scrolledComposite.setMinSize(new Point(1600, 830));
+ } else {
+ scrolledComposite.setMinSize(new Point(1000, 630));
+ }
+
+ loadExampleText();
+ }
+
+ private String hexToDecimal(String hex) {
+ StringBuilder sb = new StringBuilder();
+ String[] a = hex.toUpperCase().split("(?<=\\G..)"); //$NON-NLS-1$
+
+ for (String s : a) {
+ sb.append(String.format("%3s", (new BigInteger(s, 16)).toString()).replace(' ', '0')); //$NON-NLS-1$
+ }
+
+ return sb.toString();
+ }
+
+ private String hexToBinary(String hex) {
+ String result = new BigInteger(hex, 16).toString(2);
+ switch (hash) {
+ case ECHO224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case JH224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case BLAKE224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case RIPEMD160:
+ result = String.format("%160s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case TIGER:
+ result = String.format("%192s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA3_224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA256:
+ case SHA3_256:
+ case SKEIN_256:
+ case GOST3411:
+ case SM3:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA3_384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA512:
+ case SHA3_512:
+ case SKEIN_512:
+ case WHIRLPOOL:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SKEIN_1024:
+ result = String.format("%1024s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+
+ default:
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void setFocus() {
+ textOutput.setFocus();
+ }
+
+ public void resetView() {
+ styledTextDescription.setText(Messages.HashingView_0 + Messages.HashingView_1);
+ styledTextDescription.setStyleRange(header);
+
+ comboHash.select(0);
+ btnHexadezimal.setSelection(true);
+ btnDezimal.setSelection(false);
+ btnBinary.setSelection(false);
+
+ textInput.setText(""); //$NON-NLS-1$
+ textHashInput.setText(""); //$NON-NLS-1$
+ textOutput.setText(""); //$NON-NLS-1$
+ textHashOutput.setText(""); //$NON-NLS-1$
+ textDifference.setText(""); //$NON-NLS-1$
+ Hashpage.setUrl("");
+
+ loadExampleText();
+ }
+
+ private String computeHash(String hashName, String inputText, Text hashText, Browser hashpage, TableItem item[]) {
+ hash = hash.getName(hashName);
+ byte[] digest = null;
+ switch (hash) {
+ case ECHO224:
+ ECHOAction echo224 = new ECHOAction();
+ digest=echo224.run(224, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case ECHO256:
+ ECHOAction echo256 = new ECHOAction();
+ digest=echo256.run(256, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case ECHO384:
+ ECHOAction echo384 = new ECHOAction();
+ digest=echo384.run(384, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case ECHO512:
+ ECHOAction echo512= new ECHOAction();
+ digest=echo512.run(512, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case JH224:
+ JHAction JH224 = new JHAction();
+ digest=JH224.run(224, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+ case JH256:
+ JHAction JH256 = new JHAction();
+ digest=JH256.run(256, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+
+ case JH384:
+ JHAction JH384 = new JHAction();
+ digest=JH384.run(384, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+
+ case JH512:
+ JHAction JH512= new JHAction();
+ digest=JH512.run(512, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+ case BLAKE224:
+ BLAKE224= new Blake_Action();
+ digest=BLAKE224.run(224, inputText, null);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ for(int i=0; i sequence = findUnchanged(result);
+ ArrayList sequenceChanged = findChanged(result);
+
+ result = result.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ int lengthPrettyPrint = result.length();
+ count = lengthPrettyPrint / OUTPUT_SEPERATOR;
+
+ StringBuilder sb = new StringBuilder(result);
+
+ for (int i = 0; i < count; i++) {
+ sb.insert(((OUTPUT_SEPERATOR) * (i + 1) + i), "\n"); //$NON-NLS-1$
+ }
+
+ if (hash == HashFunction.RIPEMD160 || hash == HashFunction.TIGER
+ || hash == HashFunction.SHA3_224) {
+ sb.insert(sb.length(), "\n"); //$NON-NLS-1$
+ }
+
+ char[] bitArray = sb.toString().toCharArray();
+
+ sb.append("\n" + String.format("%1$,.2f", percent) //$NON-NLS-1$ //$NON-NLS-2$
+ + Messages.HashingView_12 + oneBits + Messages.HashingView_13 + (zeroBits + oneBits)
+ + Messages.HashingView_14 + sequence.get(0)[1] + Messages.HashingView_15 + sequence.get(0)[0] + "."); //$NON-NLS-1$
+
+ if (!sequenceChanged.isEmpty()) {
+ sb.append(Messages.HashingView_17 + sequenceChanged.get(0)[1] + Messages.HashingView_15
+ + sequenceChanged.get(0)[0] + Messages.HashingView_18 + sequence.size()
+ + Messages.HashingView_21 + sequenceChanged.size() + "."); //$NON-NLS-1$
+ }
+
+ textDifference.setText(sb.toString());
+ if (btnUnchanged.getSelection()) {
+ for (int[] is : sequence) {
+ StyleRange sr = new StyleRange();
+ sr.start = is[1] + (is[1] / 8) + ((is[1] + (is[1] / 8)) / OUTPUT_SEPERATOR);
+
+ int cr = ((((is[1] + (is[1] / 8) ) % OUTPUT_SEPERATOR) + is[0] ) / OUTPUT_SEPERATOR);
+ if ((is[1] + is[0]) % 8 != 0) {
+ int seed = ((is[1] % 8) + is[0]) / 8;
+ sr.length = is[0] + seed + cr;
+ } else {
+ int seed = 8 - (is[1] % 8);
+
+ if (is[0] <= seed) {
+ sr.length = is[0] + cr;
+ } else {
+ sr.length = is[0] + ((is[0] + seed) / 8) + cr;
+ }
+ }
+ sr.underline = true;
+ textDifference.setStyleRange(sr);
+ }
+ }
+
+ for (int i = 0; i < bitArray.length; i++) {
+ if (bitArray[i] == '1') {
+ StyleRange bits = new StyleRange();
+ bits.start = i;
+ bits.length = 1;
+ bits.foreground = this.getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_RED);
+ textDifference.setStyleRange(bits);
+ }
+ }
+
+ if (btnChanged.getSelection()) {
+ if (btnChanged.getSelection()) {
+ for (int[] is : sequenceChanged) {
+ StyleRange sr = new StyleRange();
+ sr.start = is[1] + (is[1] / 8) + ((is[1] + (is[1] / 8)) / OUTPUT_SEPERATOR);
+ int cr = ((((is[1] + (is[1] / 8) ) % OUTPUT_SEPERATOR) + is[0] ) / OUTPUT_SEPERATOR);
+
+ if ((is[1] + is[0]) % 8 != 0) {
+ int seed = ((is[1] % 8) + is[0]) / 8;
+ sr.length = is[0] + seed + cr;
+ } else {
+ int seed = 8 - (is[1] % 8);
+
+ if (is[0] <= seed) {
+ sr.length = is[0] + cr;
+ } else {
+ sr.length = is[0] + ((is[0] + seed) / 8) + cr;
+ }
+ }
+ sr.underline = true;
+ sr.foreground = this.getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_RED);
+ textDifference.setStyleRange(sr);
+ }
+ }
+ }
+ }
+ }
+
+ private ArrayList findUnchanged(String s) {
+ ArrayList result = new ArrayList<>();
+
+ String currentSequence = null;
+ String prevSequence = null;
+
+ Matcher m = Pattern.compile("(0+)").matcher(s); //$NON-NLS-1$
+ m.find();
+ prevSequence = m.group();
+ currentSequence = m.group();
+
+ while (m.find()) {
+ currentSequence = m.group();
+ if (prevSequence.length() < currentSequence.length()) {
+ prevSequence = m.group();
+ }
+ }
+
+ if (prevSequence != null) {
+ m = Pattern.compile(prevSequence).matcher(s);
+ while (m.find()) {
+ int[] tmp = new int[2];
+ tmp[0] = m.group().length();
+ tmp[1] = m.start();
+ result.add(tmp);
+ }
+ }
+ return result;
+ }
+
+ private ArrayList findChanged(String s) {
+ ArrayList result = new ArrayList<>();
+
+ String currentSequence = null;
+ String prevSequence = null;
+
+ Matcher m = Pattern.compile("(1+)").matcher(s); //$NON-NLS-1$
+ if (m.find()) {
+ prevSequence = m.group();
+ currentSequence = m.group();
+
+ while (m.find()) {
+ currentSequence = m.group();
+ if (prevSequence.length() < currentSequence.length()) {
+ prevSequence = m.group();
+ }
+ }
+ }
+
+ if (prevSequence != null) {
+ m = Pattern.compile(prevSequence).matcher(s);
+ while (m.find()) {
+ int[] tmp = new int[2];
+ tmp[0] = m.group().length();
+ tmp[1] = m.start();
+ result.add(tmp);
+ }
+ }
+ return result;
+ }
+
+ private void loadExampleText() {
+ try {
+ URL url = HashingPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+ File template = new File(FileLocator.toFileURL(url).getFile() + "templates" + File.separatorChar //$NON-NLS-1$
+ + Messages.HashingView_16);
+
+ Scanner scanner = new Scanner(template, "UTF-8"); //$NON-NLS-1$
+ String fileString = scanner.useDelimiter("\\Z").next(); //$NON-NLS-1$
+ scanner.close();
+
+ textInput.setText(fileString);
+ textOutput.setText(fileString);
+
+ } catch (IOException e) {
+ LogUtil.logError(e);
+ }
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView_Origin.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView_Origin.java
new file mode 100755
index 0000000..5639eec
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/HashingView_Origin.java
@@ -0,0 +1,983 @@
+package org.jcryptool.visual.sha3candidates.views;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.bouncycastle.crypto.digests.GOST3411Digest;
+import org.bouncycastle.crypto.digests.MD2Digest;
+import org.bouncycastle.crypto.digests.MD4Digest;
+import org.bouncycastle.crypto.digests.MD5Digest;
+import org.bouncycastle.crypto.digests.RIPEMD160Digest;
+import org.bouncycastle.crypto.digests.SHA1Digest;
+import org.bouncycastle.crypto.digests.SHA256Digest;
+import org.bouncycastle.crypto.digests.SHA512Digest;
+import org.bouncycastle.crypto.digests.SM3Digest;
+import org.bouncycastle.crypto.digests.TigerDigest;
+import org.bouncycastle.crypto.digests.WhirlpoolDigest;
+import org.bouncycastle.jcajce.provider.digest.SHA3;
+import org.bouncycastle.jcajce.provider.digest.Skein;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.swt.SWT;
+///////////////////
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.CloseWindowListener;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.browser.OpenWindowListener;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.browser.StatusTextEvent;
+import org.eclipse.swt.browser.StatusTextListener;
+import org.eclipse.swt.browser.TitleEvent;
+import org.eclipse.swt.browser.TitleListener;
+import org.eclipse.swt.browser.WindowEvent;
+/////////////////////
+
+import org.eclipse.swt.custom.ST;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.jcryptool.core.logging.utils.LogUtil;
+import org.jcryptool.visual.sha3candidates.HashingPlugin;
+import org.jcryptool.visual.sha3candidates.algorithms.HashFunction;
+import org.jcryptool.visual.sha3candidates.algorithms.ECHO.ECHOAction;
+import org.jcryptool.visual.sha3candidates.algorithms.JH.JHAction;
+import org.jcryptool.visual.sha3candidates.algorithms.BLAKE.Blake_Action;
+import org.eclipse.swt.widgets.Table;
+/**
+ *
+ * @author Ferit Dogan
+ *
+ */
+public class HashingView_Origin extends ViewPart {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.jcryptool.visual.sha3candidates.views.HashingView"; //$NON-NLS-1$
+ private static final int OUTPUT_SEPERATOR = 144;
+
+ private org.jcryptool.visual.sha3candidates.algorithms.HashFunction hash = org.jcryptool.visual.sha3candidates.algorithms.HashFunction.ECHO224;
+ private String hashInputValueHex = ""; //$NON-NLS-1$
+ private String hashOutputValueHex = ""; //$NON-NLS-1$
+ private String page="file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html";
+ private Browser Hashpage;
+ private StyledText styledTextDescription;
+ private StyleRange header;
+ private Text textInput;
+ private Text textHashInput;
+ private Text textOutput;
+ private Text textHashOutput;
+ private StyledText textDifference;
+ private Combo comboHash;
+ private Button btnHexadezimal;
+ private Button btnDezimal;
+ private Button btnBinary;
+ private Button btnChanged;
+ private Button btnUnchanged;
+
+
+ /**
+ * The constructor.
+ */
+ public HashingView_Origin() {
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ scrolledComposite.setExpandHorizontal(true);
+ scrolledComposite.setExpandVertical(true);
+ scrolledComposite.setBounds(10, 10, 639, 410);
+ Composite compositeMain = new Composite(scrolledComposite, SWT.NONE);
+//////// compositeMain.setLayout(new GridLayout(2, false));
+ compositeMain.setLayout(new GridLayout(4, false));
+ compositeMain.setBounds(10, 10, 600, 400);
+
+ styledTextDescription = new StyledText(compositeMain, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
+ styledTextDescription.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ styledTextDescription.setSelection(0, 0);
+ }
+ });
+ styledTextDescription.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ styledTextDescription.selectAll();
+ }
+ }
+ });
+ styledTextDescription.setEditable(false);
+ GridData gd_styledTextDescription = new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1);
+ gd_styledTextDescription.widthHint = 300;
+ gd_styledTextDescription.heightHint = 60;
+ styledTextDescription.setLayoutData(gd_styledTextDescription);
+ styledTextDescription.setText(Messages.HashingView_0 + Messages.HashingView_1);
+
+ header = new StyleRange();
+ header.start = 0;
+ header.length = Messages.HashingView_0.length();
+ header.fontStyle = SWT.BOLD;
+ styledTextDescription.setStyleRange(header);
+
+ Menu menu_1 = new Menu(styledTextDescription);
+ styledTextDescription.setMenu(menu_1);
+
+ MenuItem mntmCopy_1 = new MenuItem(menu_1, SWT.NONE);
+ mntmCopy_1.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ styledTextDescription.copy();
+ }
+ });
+ mntmCopy_1.setText(Messages.HashingView_mntmCopy_text);
+
+ MenuItem menuItem_1 = new MenuItem(menu_1, SWT.SEPARATOR);
+
+ MenuItem mntmSelectAll_1 = new MenuItem(menu_1, SWT.NONE);
+ mntmSelectAll_1.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ styledTextDescription.selectAll();
+ }
+ });
+ mntmSelectAll_1.setText(Messages.HashingView_mntmSelectAll_text);
+
+ Group Hashinput = new Group(compositeMain, SWT.NONE);
+////////grpHashfunction.setLayout(new GridLayout(1, false));
+ Hashinput.setLayout(new GridLayout(1, false));
+////////grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ Hashinput.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 10));
+ Hashinput.setText("Hash Input");
+
+ Group grpHashfunction = new Group(Hashinput, SWT.NONE);
+//////// grpHashfunction.setLayout(new GridLayout(1, false));
+ grpHashfunction.setLayout(new GridLayout(1, false));
+//////// grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ grpHashfunction.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ grpHashfunction.setText(Messages.HashingView_2);
+
+ Group grpHashalgorithm = new Group(compositeMain, SWT.NONE);
+ grpHashalgorithm.setLayout(new GridLayout(1, false));
+ grpHashalgorithm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 10));
+ grpHashalgorithm.setText("Hash Algorithm");
+
+ Hashpage = new Browser(grpHashalgorithm, SWT.NONE);
+// Hashapage.setLayout(new GridLayout(1, false));
+ Hashpage.setLayout(new FillLayout());
+ Hashpage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 10));
+ Hashpage.setUrl(page);
+
+
+ comboHash = new Combo(grpHashfunction, SWT.READ_ONLY);
+ comboHash.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (!textInput.getText().isEmpty()) {
+ hashInputValueHex = computeHash(comboHash.getText(), textInput.getText(), textHashInput, Hashpage);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hashOutputValueHex = computeHash(comboHash.getText(), textOutput.getText(), textHashOutput, Hashpage);
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+ computeDifference();
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ comboHash
+ .setItems(new String[] {
+ "ECHO (224 bits)", "ECHO (256 bits)", "ECHO (384 bits)", "ECHO (512 bits)", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "JH (224 bits)", "JH (256 bits)", "JH (384 bits)", "JH (512 bits)",
+ "BLAKE (224 bits)", "BLAKE (256 bits)", "BLAKE (384 bits)", "BLAKE (512 bits)",
+ "SHA-2 (256 bits)", "SHA-2 (512 bits)", "SHA-3 (224 bits)", "SHA-3 (256 bits)", "SHA-3 (384 bits)", "SHA-3 (512 bits)", "SKEIN-256 (256 bits)", "SKEIN-512 (512 bits)", "SKEIN-1024 (1024 bits)", "SM3 (256 bits)", "RIPEMD-160 (160 bits)", "TIGER (192 bits)", "GOST3411 (256 bits)", "WHIRLPOOL (512 bits)" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$
+ comboHash.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ comboHash.select(0);
+
+//////// Group grpTypeHash = new Group(compositeMain, SWT.NONE);
+ Group grpTypeHash = new Group(Hashinput, SWT.NONE);
+ grpTypeHash.setLayout(new GridLayout(3, false));
+ grpTypeHash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+ grpTypeHash.setText(Messages.HashingView_3);
+
+ btnHexadezimal = new Button(grpTypeHash, SWT.RADIO);
+ btnHexadezimal.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hashInputValueHex.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hashOutputValueHex.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+ }
+ });
+ btnHexadezimal.setSelection(true);
+ btnHexadezimal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnHexadezimal.setText(Messages.HashingView_4);
+
+ btnDezimal = new Button(grpTypeHash, SWT.RADIO);
+ btnDezimal.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hexToDecimal(hashInputValueHex);
+ hash = hash.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hexToDecimal(hashOutputValueHex);
+ hash = hash.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+ }
+ });
+ btnDezimal.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnDezimal.setText(Messages.HashingView_5);
+
+ btnBinary = new Button(grpTypeHash, SWT.RADIO);
+ btnBinary.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String hash = null;
+ if (!textInput.getText().isEmpty()) {
+ hash = hexToBinary(hashInputValueHex);
+ hash = hash.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashInput.setText(hash);
+ }
+
+ if (!textOutput.getText().isEmpty()) {
+ hash = hexToBinary(hashOutputValueHex);
+ hash = hash.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ textHashOutput.setText(hash);
+ }
+
+ }
+ });
+ btnBinary.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ btnBinary.setText(Messages.HashingView_6);
+
+//////// Group grpInput = new Group(compositeMain, SWT.NONE);
+ Group grpInput = new Group(Hashinput, SWT.NONE);
+ ////////////1->3 grpInput.setLayout(new GridLayout(1, false));
+ grpInput.setLayout(new GridLayout(1, false));
+////////////2->1 grpInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
+ grpInput.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 2));
+ grpInput.setText(Messages.HashingView_7);
+
+ textInput = new Text(grpInput, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
+ textInput.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textInput.setSelection(0, 0);
+ }
+ });
+ textInput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textInput.selectAll();
+ }
+ }
+ });
+ textInput.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (!textInput.getText().isEmpty()) {
+ hashInputValueHex = computeHash(comboHash.getText(), textInput.getText(), textHashInput, Hashpage);
+ } else {
+ textHashInput.setText(""); //$NON-NLS-1$
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+ computeDifference();
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ GridData gd_textInput = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
+ gd_textInput.heightHint = 90;
+ textInput.setLayoutData(gd_textInput);
+
+//////// Group grpOutput = new Group(compositeMain, SWT.NONE);
+ Group grpOutput = new Group(Hashinput, SWT.NONE);
+//////// grpOutput.setLayout(new GridLayout(1, false));
+ grpOutput.setLayout(new GridLayout(1, false));
+//////// grpOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
+ grpOutput.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 2));
+ grpOutput.setText(Messages.HashingView_9);
+
+ textOutput = new Text(grpOutput, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
+ textOutput.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textOutput.setSelection(0, 0);
+ }
+ });
+ textOutput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textOutput.selectAll();
+ }
+ }
+ });
+ textOutput.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (!textOutput.getText().isEmpty()) {
+ hashOutputValueHex = computeHash(comboHash.getText(), textOutput.getText(), textHashOutput, Hashpage);
+ } else {
+ textHashOutput.setText(""); //$NON-NLS-1$
+ }
+
+ if (!textInput.getText().isEmpty() && !textOutput.getText().isEmpty()) {
+ computeDifference();
+ } else {
+ textDifference.setText(""); //$NON-NLS-1$
+ }
+ }
+ });
+ GridData gd_textOutput = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
+ gd_textOutput.heightHint = 90;
+ textOutput.setLayoutData(gd_textOutput);
+
+ Group grpHashInput = new Group(compositeMain, SWT.NONE);
+ grpHashInput.setLayout(new GridLayout(4, false));
+ grpHashInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1));
+ grpHashInput.setText(Messages.HashingView_10);
+
+ textHashInput = new Text(grpHashInput, SWT.BORDER | SWT.READ_ONLY);
+ textHashInput.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL)); //$NON-NLS-1$
+ textHashInput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textHashInput.selectAll();
+ }
+ }
+ });
+ textHashInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Group grpHashOutput = new Group(compositeMain, SWT.NONE);
+ grpHashOutput.setLayout(new GridLayout(4, false));
+ grpHashOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1));
+ grpHashOutput.setText(Messages.HashingView_8);
+
+ textHashOutput = new Text(grpHashOutput, SWT.BORDER | SWT.READ_ONLY);
+ textHashOutput.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL)); //$NON-NLS-1$
+ textHashOutput.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textHashOutput.selectAll();
+ }
+ }
+ });
+ textHashOutput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Group grpUnterschied = new Group(compositeMain, SWT.NONE);
+ grpUnterschied.setLayout(new GridLayout(4, false));
+ grpUnterschied.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 4, 1));
+ grpUnterschied.setText(Messages.HashingView_11);
+
+ textDifference = new StyledText(grpUnterschied, SWT.BORDER | SWT.FULL_SELECTION | SWT.READ_ONLY | SWT.WRAP
+ | SWT.V_SCROLL);
+ textDifference.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ textDifference.setSelection(0, 0);
+ }
+ });
+ textDifference.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
+ textDifference.selectAll();
+ }
+ }
+ });
+ textDifference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 4, 1));
+
+ Menu menu = new Menu(textDifference);
+ textDifference.setMenu(menu);
+
+ MenuItem mntmCopy = new MenuItem(menu, SWT.NONE);
+ mntmCopy.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ textDifference.copy();
+ }
+ });
+ mntmCopy.setText(Messages.HashingView_mntmCopy_text);
+
+ MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
+
+ MenuItem mntmSelectAll = new MenuItem(menu, SWT.NONE);
+ mntmSelectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ textDifference.selectAll();
+ }
+ });
+ mntmSelectAll.setText(Messages.HashingView_mntmSelectAll_text);
+
+ btnUnchanged = new Button(grpUnterschied, SWT.RADIO);
+ btnUnchanged.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ computeDifference();
+ }
+ });
+ btnUnchanged.setSelection(true);
+ btnUnchanged.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+ btnUnchanged.setText(Messages.HashingView_btnUnchanged_text);
+
+ btnChanged = new Button(grpUnterschied, SWT.RADIO);
+ btnChanged.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ computeDifference();
+ }
+ });
+ btnChanged.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+ btnChanged.setText(Messages.HashingView_btnChanged_text);
+ textDifference.invokeAction(ST.CUT);
+ textDifference.invokeAction(ST.COPY);
+ textDifference.invokeAction(ST.PASTE);
+ scrolledComposite.setContent(compositeMain);
+
+ if (System.getProperty("os.name").compareToIgnoreCase("Windows 10") == 0) {
+ scrolledComposite.setMinSize(new Point(1600, 830));
+ } else {
+ scrolledComposite.setMinSize(new Point(1000, 630));
+ }
+
+ loadExampleText();
+ }
+
+ private String hexToDecimal(String hex) {
+ StringBuilder sb = new StringBuilder();
+ String[] a = hex.toUpperCase().split("(?<=\\G..)"); //$NON-NLS-1$
+
+ for (String s : a) {
+ sb.append(String.format("%3s", (new BigInteger(s, 16)).toString()).replace(' ', '0')); //$NON-NLS-1$
+ }
+
+ return sb.toString();
+ }
+
+ private String hexToBinary(String hex) {
+ String result = new BigInteger(hex, 16).toString(2);
+ switch (hash) {
+ case ECHO224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case ECHO512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case JH224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case JH512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case BLAKE224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE256:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ case BLAKE512:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case RIPEMD160:
+ result = String.format("%160s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case TIGER:
+ result = String.format("%192s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA3_224:
+ result = String.format("%224s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA256:
+ case SHA3_256:
+ case SKEIN_256:
+ case GOST3411:
+ case SM3:
+ result = String.format("%256s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA3_384:
+ result = String.format("%384s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SHA512:
+ case SHA3_512:
+ case SKEIN_512:
+ case WHIRLPOOL:
+ result = String.format("%512s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+ case SKEIN_1024:
+ result = String.format("%1024s", result).replace(' ', '0'); //$NON-NLS-1$
+ break;
+
+ default:
+ break;
+ }
+
+ return result;
+ }
+
+ @Override
+ public void setFocus() {
+ textOutput.setFocus();
+ }
+
+ public void resetView() {
+ styledTextDescription.setText(Messages.HashingView_0 + Messages.HashingView_1);
+ styledTextDescription.setStyleRange(header);
+
+ comboHash.select(0);
+ btnHexadezimal.setSelection(true);
+ btnDezimal.setSelection(false);
+ btnBinary.setSelection(false);
+
+ textInput.setText(""); //$NON-NLS-1$
+ textHashInput.setText(""); //$NON-NLS-1$
+ textOutput.setText(""); //$NON-NLS-1$
+ textHashOutput.setText(""); //$NON-NLS-1$
+ textDifference.setText(""); //$NON-NLS-1$
+ Hashpage.setUrl("");
+
+ loadExampleText();
+ }
+
+ private String computeHash(String hashName, String inputText, Text hashText, Browser hashpage) {
+ hash = hash.getName(hashName);
+ byte[] digest = null;
+ switch (hash) {
+ case ECHO224:
+ ECHOAction echo224 = new ECHOAction();
+ digest=echo224.run(224, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case ECHO256:
+ ECHOAction echo256 = new ECHOAction();
+ digest=echo256.run(256, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case ECHO384:
+ ECHOAction echo384 = new ECHOAction();
+ digest=echo384.run(384, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case ECHO512:
+ ECHOAction echo512= new ECHOAction();
+ digest=echo512.run(512, inputText);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case JH224:
+ JHAction JH224 = new JHAction();
+ digest=JH224.run(224, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+ case JH256:
+ JHAction JH256 = new JHAction();
+ digest=JH256.run(256, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+
+ case JH384:
+ JHAction JH384 = new JHAction();
+ digest=JH384.run(384, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+
+ case JH512:
+ JHAction JH512= new JHAction();
+ digest=JH512.run(512, inputText);
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/JHTutorial.html");
+ break;
+ case BLAKE224:
+ Blake_Action BLAKE224 = new Blake_Action();
+ digest=BLAKE224.run(224, inputText, null);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+ case BLAKE256:
+ Blake_Action BLAKE256 = new Blake_Action();
+ digest=BLAKE256.run(256, inputText, null);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case BLAKE384:
+ Blake_Action BLAKE384 = new Blake_Action();
+ digest=BLAKE384.run(384, inputText, null);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case BLAKE512:
+ Blake_Action BLAKE512= new Blake_Action();
+ digest=BLAKE512.run(512, inputText, null);
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+ break;
+
+ case SHA256:
+ SHA256Digest sha256 = new SHA256Digest();
+ sha256.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha256.getDigestSize()];
+ sha256.doFinal(digest, 0);
+
+ break;
+ case SHA512:
+ SHA512Digest sha512 = new SHA512Digest();
+ sha512.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha512.getDigestSize()];
+ sha512.doFinal(digest, 0);
+
+ break;
+ case SHA3_224:
+ SHA3.Digest224 sha3_224 = new SHA3.Digest224();
+ sha3_224.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_224.getDigestLength()];
+ digest = sha3_224.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SHA3_256:
+ SHA3.Digest256 sha3_256 = new SHA3.Digest256();
+ sha3_256.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_256.getDigestLength()];
+ digest = sha3_256.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SHA3_384:
+ SHA3.Digest384 sha3_384 = new SHA3.Digest384();
+ sha3_384.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_384.getDigestLength()];
+ digest = sha3_384.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SHA3_512:
+ SHA3.Digest512 sha3_512 = new SHA3.Digest512();
+ sha3_512.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sha3_512.getDigestLength()];
+ digest = sha3_512.digest();
+ hashpage.setUrl("file:///C:/workspace1/org.jcryptool.visual.sha3candidates/nl/en/help/content/ECHOTutorial.html");
+
+ break;
+ case SKEIN_256:
+ Skein.Digest_256_256 skein_256 = new Skein.Digest_256_256();
+ skein_256.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[skein_256.getDigestLength()];
+ digest = skein_256.digest();
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/SkeinTutorial.html");
+
+ break;
+ case SKEIN_512:
+ Skein.Digest_512_512 skein_512 = new Skein.Digest_512_512();
+ skein_512.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[skein_512.getDigestLength()];
+ digest = skein_512.digest();
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/SkeinTutorial.html");
+
+ break;
+ case SKEIN_1024:
+ Skein.Digest_1024_1024 skein_1024 = new Skein.Digest_1024_1024();
+ skein_1024.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[skein_1024.getDigestLength()];
+ digest = skein_1024.digest();
+ hashpage.setUrl("file:///C:/workspace1/git/crypto/org.jcryptool.crypto.modern.sha3/nl/en/help/content/SkeinTutorial.html");
+
+ break;
+ case RIPEMD160:
+ RIPEMD160Digest ripemd160 = new RIPEMD160Digest();
+ ripemd160.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[ripemd160.getDigestSize()];
+ ripemd160.doFinal(digest, 0);
+
+ break;
+ case SM3:
+ SM3Digest sm3 = new SM3Digest();
+ sm3.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[sm3.getDigestSize()];
+ sm3.doFinal(digest, 0);
+
+ break;
+ case TIGER:
+ TigerDigest tiger = new TigerDigest();
+ tiger.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[tiger.getDigestSize()];
+ tiger.doFinal(digest, 0);
+
+ break;
+ case GOST3411:
+ GOST3411Digest gost3411 = new GOST3411Digest();
+ gost3411.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[gost3411.getDigestSize()];
+ gost3411.doFinal(digest, 0);
+
+ break;
+ case WHIRLPOOL:
+ WhirlpoolDigest whirlpool = new WhirlpoolDigest();
+ whirlpool.update(inputText.getBytes(), 0, inputText.getBytes().length);
+ digest = new byte[whirlpool.getDigestSize()];
+ whirlpool.doFinal(digest, 0);
+
+ break;
+ default:
+ break;
+ }
+
+ String hashHexValue = new String(Hex.encode(digest));
+ if (btnHexadezimal.getSelection()) {
+ String hashValueOutput = hashHexValue.toUpperCase().replaceAll(".{2}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ hashText.setText(hashValueOutput);
+ } else if (btnDezimal.getSelection()) {
+ String hashValue = hexToDecimal(hashHexValue);
+ hashValue = hashValue.replaceAll(".{3}", "$0 "); //$NON-NLS-1$ //$NON-NLS-2$
+ hashText.setText(hashValue);
+ } else if (btnBinary.getSelection()) {
+ String hashValue = hexToBinary(hashHexValue);
+ hashValue = hashValue.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+ hashText.setText(hashValue);
+ }
+
+ return hashHexValue;
+ }
+
+ private void computeDifference() {
+ BigInteger input = new BigInteger(hashInputValueHex, 16);
+ BigInteger output = new BigInteger(hashOutputValueHex, 16);
+ BigInteger zero=new BigInteger("000000", 16);
+ String result = input.xor(output).toString(16);
+ result = hexToBinary(result);
+
+ if (result.toString().equalsIgnoreCase("0")) { //$NON-NLS-1$
+ textDifference.setText((hexToBinary("0").replaceAll(".{8}", "$0#"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ int count = result.length();
+ int zeroBits = result.length() - result.replace("0", "").length(); //$NON-NLS-1$ //$NON-NLS-2$
+ int oneBits = result.length() - result.replace("1", "").length(); //$NON-NLS-1$ //$NON-NLS-2$
+ double percent = ((double) oneBits / (double) count) * 100;
+ ArrayList sequence = findUnchanged(result);
+ ArrayList sequenceChanged = findChanged(result);
+
+ result = result.replaceAll(".{8}", "$0#"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ int lengthPrettyPrint = result.length();
+ count = lengthPrettyPrint / OUTPUT_SEPERATOR;
+
+ StringBuilder sb = new StringBuilder(result);
+
+ for (int i = 0; i < count; i++) {
+ sb.insert(((OUTPUT_SEPERATOR) * (i + 1) + i), "\n"); //$NON-NLS-1$
+ }
+
+ if (hash == HashFunction.RIPEMD160 || hash == HashFunction.TIGER
+ || hash == HashFunction.SHA3_224) {
+ sb.insert(sb.length(), "\n"); //$NON-NLS-1$
+ }
+
+ char[] bitArray = sb.toString().toCharArray();
+
+ sb.append("\n" + String.format("%1$,.2f", percent) //$NON-NLS-1$ //$NON-NLS-2$
+ + Messages.HashingView_12 + oneBits + Messages.HashingView_13 + (zeroBits + oneBits)
+ + Messages.HashingView_14 + sequence.get(0)[1] + Messages.HashingView_15 + sequence.get(0)[0] + "."); //$NON-NLS-1$
+
+ if (!sequenceChanged.isEmpty()) {
+ sb.append(Messages.HashingView_17 + sequenceChanged.get(0)[1] + Messages.HashingView_15
+ + sequenceChanged.get(0)[0] + Messages.HashingView_18 + sequence.size()
+ + Messages.HashingView_21 + sequenceChanged.size() + "."); //$NON-NLS-1$
+ }
+
+ textDifference.setText(sb.toString());
+ if (btnUnchanged.getSelection()) {
+ for (int[] is : sequence) {
+ StyleRange sr = new StyleRange();
+ sr.start = is[1] + (is[1] / 8) + ((is[1] + (is[1] / 8)) / OUTPUT_SEPERATOR);
+
+ int cr = ((((is[1] + (is[1] / 8) ) % OUTPUT_SEPERATOR) + is[0] ) / OUTPUT_SEPERATOR);
+ if ((is[1] + is[0]) % 8 != 0) {
+ int seed = ((is[1] % 8) + is[0]) / 8;
+ sr.length = is[0] + seed + cr;
+ } else {
+ int seed = 8 - (is[1] % 8);
+
+ if (is[0] <= seed) {
+ sr.length = is[0] + cr;
+ } else {
+ sr.length = is[0] + ((is[0] + seed) / 8) + cr;
+ }
+ }
+ sr.underline = true;
+ textDifference.setStyleRange(sr);
+ }
+ }
+
+ for (int i = 0; i < bitArray.length; i++) {
+ if (bitArray[i] == '1') {
+ StyleRange bits = new StyleRange();
+ bits.start = i;
+ bits.length = 1;
+ bits.foreground = this.getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_RED);
+ textDifference.setStyleRange(bits);
+ }
+ }
+
+ if (btnChanged.getSelection()) {
+ if (btnChanged.getSelection()) {
+ for (int[] is : sequenceChanged) {
+ StyleRange sr = new StyleRange();
+ sr.start = is[1] + (is[1] / 8) + ((is[1] + (is[1] / 8)) / OUTPUT_SEPERATOR);
+ int cr = ((((is[1] + (is[1] / 8) ) % OUTPUT_SEPERATOR) + is[0] ) / OUTPUT_SEPERATOR);
+
+ if ((is[1] + is[0]) % 8 != 0) {
+ int seed = ((is[1] % 8) + is[0]) / 8;
+ sr.length = is[0] + seed + cr;
+ } else {
+ int seed = 8 - (is[1] % 8);
+
+ if (is[0] <= seed) {
+ sr.length = is[0] + cr;
+ } else {
+ sr.length = is[0] + ((is[0] + seed) / 8) + cr;
+ }
+ }
+ sr.underline = true;
+ sr.foreground = this.getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_RED);
+ textDifference.setStyleRange(sr);
+ }
+ }
+ }
+ }
+ }
+
+ private ArrayList findUnchanged(String s) {
+ ArrayList result = new ArrayList<>();
+
+ String currentSequence = null;
+ String prevSequence = null;
+
+ Matcher m = Pattern.compile("(0+)").matcher(s); //$NON-NLS-1$
+ m.find();
+ prevSequence = m.group();
+ currentSequence = m.group();
+
+ while (m.find()) {
+ currentSequence = m.group();
+ if (prevSequence.length() < currentSequence.length()) {
+ prevSequence = m.group();
+ }
+ }
+
+ if (prevSequence != null) {
+ m = Pattern.compile(prevSequence).matcher(s);
+ while (m.find()) {
+ int[] tmp = new int[2];
+ tmp[0] = m.group().length();
+ tmp[1] = m.start();
+ result.add(tmp);
+ }
+ }
+ return result;
+ }
+
+ private ArrayList findChanged(String s) {
+ ArrayList result = new ArrayList<>();
+
+ String currentSequence = null;
+ String prevSequence = null;
+
+ Matcher m = Pattern.compile("(1+)").matcher(s); //$NON-NLS-1$
+ if (m.find()) {
+ prevSequence = m.group();
+ currentSequence = m.group();
+
+ while (m.find()) {
+ currentSequence = m.group();
+ if (prevSequence.length() < currentSequence.length()) {
+ prevSequence = m.group();
+ }
+ }
+ }
+
+ if (prevSequence != null) {
+ m = Pattern.compile(prevSequence).matcher(s);
+ while (m.find()) {
+ int[] tmp = new int[2];
+ tmp[0] = m.group().length();
+ tmp[1] = m.start();
+ result.add(tmp);
+ }
+ }
+ return result;
+ }
+
+ private void loadExampleText() {
+ try {
+ URL url = HashingPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+ File template = new File(FileLocator.toFileURL(url).getFile() + "templates" + File.separatorChar //$NON-NLS-1$
+ + Messages.HashingView_16);
+
+ Scanner scanner = new Scanner(template, "UTF-8"); //$NON-NLS-1$
+ String fileString = scanner.useDelimiter("\\Z").next(); //$NON-NLS-1$
+ scanner.close();
+
+ textInput.setText(fileString);
+ textOutput.setText(fileString);
+
+ } catch (IOException e) {
+ LogUtil.logError(e);
+ }
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/Messages.java b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/Messages.java
new file mode 100755
index 0000000..052e29a
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/Messages.java
@@ -0,0 +1,39 @@
+package org.jcryptool.visual.sha3candidates.views;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jcryptool.visual.sha3candidates.views.messages"; //$NON-NLS-1$
+ public static String HashingView_0;
+ public static String HashingView_1;
+ public static String HashingView_10;
+ public static String HashingView_11;
+ public static String HashingView_12;
+ public static String HashingView_13;
+ public static String HashingView_14;
+ public static String HashingView_15;
+ public static String HashingView_16;
+ public static String HashingView_17;
+ public static String HashingView_18;
+ public static String HashingView_2;
+ public static String HashingView_21;
+ public static String HashingView_3;
+ public static String HashingView_4;
+ public static String HashingView_5;
+ public static String HashingView_6;
+ public static String HashingView_7;
+ public static String HashingView_8;
+ public static String HashingView_9;
+ public static String HashingView_mntmCopy_text;
+ public static String HashingView_mntmSelectAll_text;
+ public static String HashingView_btnUnchanged_text;
+ public static String HashingView_btnChanged_text;
+ public static String HashingView_01;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/messages.properties b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/messages.properties
new file mode 100755
index 0000000..05ffaba
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/messages.properties
@@ -0,0 +1,27 @@
+#Eclipse modern messages class
+#Sat Mar 07 13:03:56 CET 2015
+HashingView_0=SHA3 Candidates
+HashingView_01=\nFirst the message is extended so that its length is congruent to 447 modulo 512.\n Length extension is performed by appending a bit 1 followed by a sufficient number of 0 bits. At least one bit and at most 512 are appended.\n Then a bit 1 is added, followed by a 64-bit unsigned big-endian representation of `. Padding can be represented as m0,..m, 1000 . . . 0001, .\n This procedure guarantees that the bit length of the padded message is a multiple of 512.\n
+HashingView_1=\nA hash function maps a large input set to a smaller output set. The input is of variable length, however, the output, usually has a small fixed length. Here, it is possible to select a hash function and the representation type of the hash values. The hash values of both input texts are calculated and displayed at once. The difference between the two hash values displayed at the bottom is a measure of the sensitivity of a hash value concerning changes in the input.
+HashingView_10=Hash value
+HashingView_11=Difference of the two hash values
+HashingView_12=% of the bits are different (
+HashingView_13=\ of
+HashingView_14=). Longest unchanged bit sequence\: Offset
+HashingView_15=, length
+HashingView_16=example_en.txt
+HashingView_17=\ Longest changed bit sequence\: Offset
+HashingView_18=.\r\nNumber of longest bit sequences\: unchanged \=
+HashingView_2=Select a hash function
+HashingView_21=\ ; changed \=
+HashingView_3=Representation of the hash values
+HashingView_4=hexadecimal
+HashingView_5=decimal
+HashingView_6=binary
+HashingView_7=Input String
+HashingView_8=Hash value (salt added)
+HashingView_9=Salt
+HashingView_btnChanged_text=Underline longest changed bit sequences
+HashingView_btnUnchanged_text=Underline longest unchanged bit sequences
+HashingView_mntmCopy_text=Copy
+HashingView_mntmSelectAll_text=Select All
diff --git a/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/messages_de.properties b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/messages_de.properties
new file mode 100755
index 0000000..5907121
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/src/org/jcryptool/visual/sha3candidates/views/messages_de.properties
@@ -0,0 +1,26 @@
+#Eclipse modern messages class
+#Sat Mar 07 20:33:49 CET 2015
+HashingView_0=SHA3\u00E4t
+HashingView_1=\nEine Hashfunktion bildet eine gro\u00DFe Eingabemenge auf eine kleinere Zielmenge ab. Die Eingabe hat unterschiedliche L\u00E4ngen, dagegen hat die Ausgabe meist eine feste L\u00E4nge. Hier k\u00F6nnen Sie eine Hashfunktion und die Darstellung der Hashwerte ausw\u00E4hlen. Die Hashwerte beider Eingabetexte werden berechnet und sofort angezeigt. Der Unterschied der beiden Hashwerte ist ein Ma\u00DF f\u00FCr die Sensitivit\u00E4t der Hashwerte bzgl. \u00C4derungen in der Eingabe (er wird unten angezeigt).
+HashingView_10=Hashwert 1
+HashingView_11=Unterschied der beiden Hashwerte
+HashingView_12=% der Bits unterscheiden sich (
+HashingView_13=\ von
+HashingView_14=). L\u00E4ngste unver\u00E4nderte Bitfolge\: Offset
+HashingView_15=, L\u00E4nge
+HashingView_16=example_de.txt
+HashingView_17=\ L\u00E4ngste ver\u00E4nderte Bitfolge\: Offset
+HashingView_18=.\r\nAnzahl der l\u00E4ngsten Bitfolgen\: unver\u00E4ndert \=
+HashingView_2=Auswahl der Hashfunktion
+HashingView_21=\ ; ver\u00E4ndert \=
+HashingView_3=Darstellung der Hashwerte
+HashingView_4=hexadezimal
+HashingView_5=dezimal
+HashingView_6=bin\u00E4r
+HashingView_7=Eingabe 1
+HashingView_8=Hashwert 2
+HashingView_9=Eingabe 2
+HashingView_btnChanged_text=Unterstreiche l\u00E4ngste ver\u00E4nderte Bitfolgen
+HashingView_btnUnchanged_text=Unterstreiche l\u00E4ngste unver\u00E4nderte Bitfolgen
+HashingView_mntmCopy_text=Kopieren
+HashingView_mntmSelectAll_text=Alles markieren
diff --git a/org.jcryptool.visual.sha3candidates/templates/example_de.txt b/org.jcryptool.visual.sha3candidates/templates/example_de.txt
new file mode 100755
index 0000000..a0074dd
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/templates/example_de.txt
@@ -0,0 +1,32 @@
+Dies ist die JCrypTool Beispieldatei.
+
+Sie können diese Datei für einen schnellen Start mit JCrypTool
+nutzen, indem Sie die Datei z.B. über das Menü "Algorithmen"
+verschlüsseln oder digital signieren, oder im Menü
+"Analyse" verschiedene Analysen auf eine verschlüsselte Datei anwenden.
+
+Noch einfacher gelangen Sie zu sämtlichen kryptografischen
+Operationen über die "Krypto-Explorer" Sicht auf der rechten Seite.
+Nach einem Doppelklick auf den gewünschten Eintrag auf dem
+"Algorithmen" Tab öffnet sich ein Assistent und führt Sie
+Schritt für Schritt durch den Verschlüsselungsprozess. Das
+Entschlüsseln erfolgt später auf dieselbe Art und Weise.
+
+Alle angebotenen Algorithmen und auch die Analysen
+benötigen immer eine geöffnete Datei in einem der JCrypTool
+Editoren. Visualisierungen und Spiele sind dagegen in der Regel
+unabhängig von einer geöffneten Datei. Wo auch immer eine Datei
+benötigt wird, können Sie diese Beispieldatei verwenden oder
+eine beliebige eigene Datei öffnen. Ihre Originaldatei bleibt
+dabei stets unangetastet erhalten, jede kryptografische
+Operation generiert eine neue Arbeitsdatei.
+
+Bei der Suche nach einem bestimmten Algorithmus (auch Analyse,
+Visualisierung oder Spiel) hilft Ihnen das Filterfeld oben in
+der "Krypto-Explorer" Sicht. Hiermit wird der gerade aktive Tab auf
+zum Suchbegriff passende Einträge eingeschränkt.
+
+Weitere Informationen zum Lernen, Anwenden und Erweitern von
+JCrypTool finden Sie in der umfangreichen Online-Hilfe, die Sie
+über das Menü "Hilfe" --> "Inhaltsverzeichnis der Hilfetexte"
+aufrufen können.
\ No newline at end of file
diff --git a/org.jcryptool.visual.sha3candidates/templates/example_en.txt b/org.jcryptool.visual.sha3candidates/templates/example_en.txt
new file mode 100755
index 0000000..2a264b9
--- /dev/null
+++ b/org.jcryptool.visual.sha3candidates/templates/example_en.txt
@@ -0,0 +1,29 @@
+This is the JCrypTool sample file.
+
+You can use this file for a fast start with JCrypTool, e.g. by
+encrypting or digitally signing it using the 'Algorithms' menu,
+or by applying one of the analysis offered in the
+'Analysis' menu.
+
+All cryptographic operations are additionally arranged in the
+'Crypto Explorer' view on the right side. A double click on the
+selected entry on the 'Algorithms' tab launches a wizard which
+guides you step by step through the encryption process.
+Decrypting the file at a later time works the same way.
+
+All offered algorithms as well as all analysis always
+require an opened file in one of the JCrypTool editors.
+Visualizations and games on the other hand are normally
+independent of any opened file. You can either use this sample
+file or open any of your own files wherever one is required.
+The original file remains untouched all the time, every
+cryptographic operation creates its own working file.
+
+The filter field on top of the 'Crypto Explorer' view can help you
+searching a particular algorithm (as well as an analysis,
+visualization or game). Using this field filters the currently
+active tab on matching results.
+
+More information on learning, using and extending JCrypTool is
+available in the extensive online help, which can be accessed
+via the menu 'Help' --> 'Help Contents'.
\ No newline at end of file