Skip to content

Commit

Permalink
check number of bytes, allow custom value
Browse files Browse the repository at this point in the history
  • Loading branch information
xelan committed Feb 26, 2017
1 parent 4cd01ba commit cc9b11f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions launch4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<runtimeBits>64/32</runtimeBits>
</jre>
<versionInfo>
<fileVersion>0.1.0.0</fileVersion>
<fileVersion>0.1.1.0</fileVersion>
<txtFileVersion>0</txtFileVersion>
<fileDescription>AES-256 Key Generator &amp; Checksum Calculator</fileDescription>
<copyright>Andreas Erhard</copyright>
<productVersion>0.1.0.0</productVersion>
<productVersion>0.1.1.0</productVersion>
<txtProductVersion>0</txtProductVersion>
<productName>AES-256 Key Generator &amp;amp; Checksum Calculator</productName>
<companyName>Andreas Erhard</companyName>
Expand Down
11 changes: 8 additions & 3 deletions src/at/andaris/keyutil/CalculatorForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class CalculatorForm extends javax.swing.JFrame {

public static final String VERSION = "0.1.0";
public static final String VERSION = "0.1.1";

/**
* Creates new form ContactEditor
Expand Down Expand Up @@ -188,8 +188,13 @@ private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
return;
}

int n = 3;

try {
int n = Integer.parseInt(numberBytes);
n = Integer.parseInt(numberBytes);
if (n < 1 || n > 32) {
throw new NumberFormatException();
}
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Invalid number of bytes!");

Expand All @@ -198,7 +203,7 @@ private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-

String result = "";
try {
result = Calculator.calcCheckSumFromKey(key, 3);
result = Calculator.calcCheckSumFromKey(key, n);
} catch (NoSuchAlgorithmException e) {
JOptionPane.showMessageDialog(this, "Hash SHA-256 is not supported on your platform.");

Expand Down

0 comments on commit cc9b11f

Please sign in to comment.