Update links and timestamp on multiple link accesses #77
@ -31,15 +31,15 @@ public class DownloadSchematic {
|
||||
private static final String BASE = "https://steamwar.de/download.php?schem=";
|
||||
|
||||
public static String getLink(Schematic schem){
|
||||
MessageDigest cript;
|
||||
MessageDigest digest;
|
||||
|
||||
try {
|
||||
cript = MessageDigest.getInstance("SHA-1");
|
||||
digest = MessageDigest.getInstance("SHA-1");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
cript.reset();
|
||||
cript.update((Instant.now().toString() + schem.getSchemOwner() + schem.getSchemID()).getBytes());
|
||||
String hash = BaseEncoding.base16().encode(cript.digest());
|
||||
digest.reset();
|
||||
digest.update((Instant.now().toString() + schem.getSchemOwner() + schem.getSchemID()).getBytes());
|
||||
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);
|
||||
return BASE + hash;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Die Benennung dieser Sache kommt woher?
Internet.
Wärest du so nett und würdest es bitte 'crypt' nennen? Danke