1
Fork 0
mirror of https://github.com/Steffo99/unimore-oop-2020-cleaver.git synced 2024-11-23 08:34:19 +00:00

Commit all examples

This commit is contained in:
Steffo 2020-01-12 16:11:45 +01:00
parent d7890dce4b
commit 1a004172b5
12 changed files with 9 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Cleaver><Crypt algorithm="AES" iteration-count="65535" iv="-10,6,-6,63,-68,-106,-102,-12,59,-58,-123,-76,-16,-29,-75,-67," key-algorithm="PBKDF2WithHmacSHA512" key-length="256" mode-of-operation="CFB8" padding="NoPadding" salt="-60,-84,108,93,100,5,63,44,"><Deflate><Split part-size="16384" parts="4"><OriginalFile>AllThreeExample.png</OriginalFile></Split></Deflate></Crypt></Cleaver>

Binary file not shown.

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Cleaver><Crypt algorithm="AES" iteration-count="65535" iv="-61,-121,-17,24,95,42,71,-71,-92,105,-70,67,-104,45,-19,-90," key-algorithm="PBKDF2WithHmacSHA512" key-length="256" mode-of-operation="CFB8" padding="NoPadding" salt="4,66,-45,109,22,-24,39,-104,"><Simple><OriginalFile>CryptExample.gif</OriginalFile></Simple></Crypt></Cleaver>

Binary file not shown.

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Cleaver><Crypt algorithm="AES" iteration-count="65535" iv="24,126,-55,1,-107,-95,31,104,-68,-14,103,-47,126,-45,10,-1," key-algorithm="PBKDF2WithHmacSHA512" key-length="256" mode-of-operation="CFB8" padding="NoPadding" salt="-2,-19,-74,4,-2,-105,-114,-85,"><Simple><OriginalFile>CryptTextExample.txt</OriginalFile></Simple></Crypt></Cleaver>

View file

@ -47,8 +47,9 @@ public class FileSelectRow extends Row {
openFileChooserButton = new JButton("Select files..."); openFileChooserButton = new JButton("Select files...");
openFileChooserButton.addActionListener(e -> { openFileChooserButton.addActionListener(e -> {
fileChooser.showOpenDialog(this); if(fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
this.update(); this.update();
}
}); });
this.add(openFileChooserButton); this.add(openFileChooserButton);

View file

@ -135,7 +135,7 @@ public class CleaverCryptInputStream extends FilterInputStream implements ICleav
byte[] encryptedByte = new byte[1]; byte[] encryptedByte = new byte[1];
encryptedByte[0] = (byte)encryptedInt; encryptedByte[0] = (byte)encryptedInt;
byte[] decryptedByte = cipher.update(encryptedByte); byte[] decryptedByte = cipher.update(encryptedByte);
return decryptedByte[0]; return ((int)decryptedByte[0] & 0xFF);
} }
/** /**
@ -180,7 +180,7 @@ public class CleaverCryptInputStream extends FilterInputStream implements ICleav
} }
b[off + i] = (byte)c; b[off + i] = (byte)c;
} }
} catch (IOException ee) { } catch (IOException ignored) {
} }
return i; return i;
} }

View file

@ -165,7 +165,7 @@ public class CleaverCryptOutputStream extends FilterOutputStream implements ICle
byte[] decryptedByte = new byte[1]; byte[] decryptedByte = new byte[1];
decryptedByte[0] = (byte)decryptedInt; decryptedByte[0] = (byte)decryptedInt;
byte[] encryptedByte = cipher.update(decryptedByte); byte[] encryptedByte = cipher.update(decryptedByte);
int encryptedInt = encryptedByte[0]; int encryptedInt = ((int)encryptedByte[0] & 0xFF);
super.write(encryptedInt); super.write(encryptedInt);
} }