add hashing, add maximum and minimum args length (broken)

also add other stuff but just check it yourself lol
This commit is contained in:
ChomeNS
2023-03-18 21:12:37 +07:00
parent d0f5d29092
commit fce5527abe
15 changed files with 237 additions and 40 deletions

View File

@@ -0,0 +1,34 @@
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);
}
}