SteamWar/SpigotCore
Archiviert
13
0
Dieser Commit ist enthalten in:
Lixfel 2020-12-19 12:19:01 +01:00
Ursprung f00ffb32a5
Commit dba63ffa90

Datei anzeigen

@ -31,15 +31,15 @@ public class DownloadSchematic {
private static final String BASE = "https://steamwar.de/download.php?schem="; private static final String BASE = "https://steamwar.de/download.php?schem=";
public static String getLink(Schematic schem){ public static String getLink(Schematic schem){
MessageDigest cript; MessageDigest digest;
try { try {
cript = MessageDigest.getInstance("SHA-1"); digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
throw new SecurityException(e); throw new SecurityException(e);
} }
cript.reset(); digest.reset();
cript.update((Instant.now().toString() + schem.getSchemOwner() + schem.getSchemID()).getBytes()); digest.update((Instant.now().toString() + schem.getSchemOwner() + schem.getSchemID()).getBytes());
String hash = BaseEncoding.base16().encode(cript.digest()); String hash = BaseEncoding.base16().encode(digest.digest());
SQL.update("INSERT INTO SchemDownload (SchemID, Link) VALUES (?, ?) ON DUPLICATE KEY UPDATE Link = VALUES(Link)", schem.getSchemID(), hash); SQL.update("INSERT INTO SchemDownload (SchemID, Link) VALUES (?, ?) ON DUPLICATE KEY UPDATE Link = VALUES(Link)", schem.getSchemID(), hash);
return BASE + hash; return BASE + hash;
} }