Files
chomens-bot-java/src/main/java/me/chayapak1/chomensbot_mabe/plugins/HashingPlugin.java
ChomeNS fce5527abe add hashing, add maximum and minimum args length (broken)
also add other stuff but just check it yourself lol
2023-03-18 21:12:37 +07:00

35 lines
1.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package me.chayapak1.chomensbot_mabe.plugins;
import lombok.Getter;
import me.chayapak1.chomensbot_mabe.Bot;
import com.google.common.hash.Hashing;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
public class HashingPlugin {
@Getter private String hash;
@Getter private String ownerHash;
public HashingPlugin (Bot bot) {
bot.executor().schedule(this::update, 2, TimeUnit.SECONDS);
}
public void update () {
final String ownerHashKey = "b)R<><52>nF<6E>CW<43><57><EFBFBD>#<23>\\[<5B>S*8\"t^eia<69>Z<EFBFBD><5A>k<EFBFBD><6B><EFBFBD><EFBFBD>K1<4B>8zȢ<7A>";
final String normalHashKey = "<EFBFBD>iB_D<EFBFBD><EFBFBD><EFBFBD>k<EFBFBD><EFBFBD>j8H<EFBFBD>{?[/ڭ<>f<EFBFBD><>^-=<3D>Ț<EFBFBD><C89A>v]<5D><>g><3E><>=c";
final String hashValue = System.currentTimeMillis() / 10_000 + normalHashKey;
hash = Hashing.sha256()
.hashString(hashValue, StandardCharsets.UTF_8)
.toString().substring(0, 16);
final String ownerHashValue = System.currentTimeMillis() / 10_000 + ownerHashKey;
ownerHash = Hashing.sha256()
.hashString(ownerHashValue, StandardCharsets.UTF_8)
.toString().substring(0, 16);
}
}