Restructure "net" packages

This commit is contained in:
P0nk
2021-07-18 14:26:23 +02:00
parent 11e83522d6
commit 9e3f3cc036
16 changed files with 93 additions and 99 deletions

View File

@@ -0,0 +1,27 @@
package net.encryption;
public class InitializationVector {
private final byte[] bytes;
private InitializationVector(byte[] bytes) {
this.bytes = bytes;
}
public byte[] getBytes() {
return bytes;
}
public static InitializationVector generateSend() {
byte[] ivSend = {82, 48, 120, getRandomByte()};
return new InitializationVector(ivSend);
}
public static InitializationVector generateReceive() {
byte[] ivRecv = {70, 114, 122, getRandomByte()};
return new InitializationVector(ivRecv);
}
private static byte getRandomByte() {
return (byte) (Math.random() * 255);
}
}