Compare commits
2 commits
d38a801404
...
fb459defea
Author | SHA1 | Date | |
---|---|---|---|
fb459defea | |||
f3508cb27f |
4 changed files with 31 additions and 10 deletions
16
build.gradle
16
build.gradle
|
@ -39,14 +39,6 @@ javadoc {
|
|||
new URL("https://raw.githubusercontent.com/TudbuT/tools/master/dark_javadoc.css").newInputStream().
|
||||
readLines().join("\n").getBytes()
|
||||
); f.close()
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
doLast {
|
||||
File jar = new File("build/libs/tuddylib.jar")
|
||||
File loc = new File("TuddyLIB.jar")
|
||||
jar.renameTo(loc)
|
||||
|
||||
ZipOutputStream out = new ZipOutputStream(new FileOutputStream("TuddyLIB-javadoc.zip"))
|
||||
new File("build/docs/javadoc").eachFileRecurse(groovy.io.FileType.FILES) {
|
||||
|
@ -60,6 +52,14 @@ jar {
|
|||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
doLast {
|
||||
File jar = new File("build/libs/tuddylib.jar")
|
||||
File loc = new File("TuddyLIB.jar")
|
||||
jar.renameTo(loc)
|
||||
}
|
||||
}
|
||||
|
||||
//jar.dependsOn("javadoc")
|
||||
|
||||
publishing {
|
||||
|
|
|
@ -115,6 +115,18 @@ public class TypedInputStream {
|
|||
}
|
||||
return booleans;
|
||||
}
|
||||
|
||||
public byte[] readByteArray() throws IOException {
|
||||
byte[] bytes = new byte[readInt()];
|
||||
int n = 0;
|
||||
while ((n += stream.read(bytes, n, bytes.length - n)) != 0);
|
||||
if(n != bytes.length) {
|
||||
byte[] cutBytes = new byte[n];
|
||||
System.arraycopy(bytes, 0, cutBytes, 0, n);
|
||||
return cutBytes;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public String readString() throws IOException {
|
||||
int i = readInt();
|
||||
|
|
|
@ -118,6 +118,13 @@ public class TypedOutputStream {
|
|||
stream.flush();
|
||||
return booleans;
|
||||
}
|
||||
|
||||
public byte[] writeByteArray(byte[] bytes) throws IOException {
|
||||
int i = bytes.length;
|
||||
writeInt(i);
|
||||
stream.write(bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public String writeString(String string) throws IOException {
|
||||
int i = string.length();
|
||||
|
|
|
@ -5,6 +5,8 @@ import de.tudbut.tools.Hasher;
|
|||
import de.tudbut.tools.ObjectSerializerTCN;
|
||||
import de.tudbut.tools.Tools;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -18,7 +20,7 @@ public class Key implements Cloneable {
|
|||
* Generates a random Key
|
||||
*/
|
||||
public Key() {
|
||||
string = Tools.randomAlphanumericString(1024);
|
||||
this(SecureRandom.getSeed(1024));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +36,7 @@ public class Key implements Cloneable {
|
|||
* @param bytes Key as byte[]
|
||||
*/
|
||||
public Key(byte[] bytes) {
|
||||
string = new String(bytes);
|
||||
string = new String(bytes, StandardCharsets.ISO_8859_1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue