mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-15 17:45:10 +00:00
Use UTF8 encoding explicitly in string byte conversions
This commit is contained in:
1 parent
a7a0c1c37d
commit
a04efef8a8
2 files changed
+5
-3
No files matched your search
@@ -40,6 +40,7 @@ import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -171,7 +172,7 @@ public final class ContributorFancinessHandler extends LayerRenderer<AbstractCli
|
||||
try {
|
||||
URL url = new URL("https://raw.githubusercontent.com/Vazkii/Botania/master/contributors.properties");
|
||||
Properties props = new Properties();
|
||||
try (InputStreamReader reader = new InputStreamReader(url.openStream())) {
|
||||
try (InputStreamReader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) {
|
||||
props.load(reader);
|
||||
load(props);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.common.core.helper;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
@@ -25,7 +26,7 @@ public final class StringObfuscator {
|
||||
if(str != null)
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
return new HexBinaryAdapter().marshal(md.digest(dontRainbowTableMeOrMySonEverAgain(str).getBytes()));
|
||||
return new HexBinaryAdapter().marshal(md.digest(dontRainbowTableMeOrMySonEverAgain(str).getBytes(StandardCharsets.UTF_8)));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -35,7 +36,7 @@ public final class StringObfuscator {
|
||||
private static String dontRainbowTableMeOrMySonEverAgain(String str) throws NoSuchAlgorithmException {
|
||||
str += reverseString(str);
|
||||
SecureRandom rand = SecureRandom.getInstance("SHA1PRNG");
|
||||
rand.setSeed(str.getBytes());
|
||||
rand.setSeed(str.getBytes(StandardCharsets.UTF_8));
|
||||
int l = str.length();
|
||||
int steps = rand.nextInt(l);
|
||||
char[] chrs = str.toCharArray();
|
||||
|
||||
Reference in new issue
Block a user