All checks were successful
Deploy datapack to dev / Build (push) Successful in 6s
42 lines
818 B
Plaintext
42 lines
818 B
Plaintext
@lazy
|
|
function test_hashInteger($test_val) {
|
|
$integerToHash = $test_val;
|
|
|
|
database.crypt.hashInteger();
|
|
|
|
tellraw @a $hashedInteger.toString();
|
|
|
|
database.crypt.clean();
|
|
|
|
tellraw @a $hashedInteger.toString();
|
|
}
|
|
|
|
class database.crypt {
|
|
function hashString() {}
|
|
|
|
function hashInteger() {
|
|
$cryptMultiplyer = 49;
|
|
$cryptConstant = 7;
|
|
$cryptPrime = 15331;
|
|
|
|
#
|
|
# $integerToHash must already be initialized
|
|
#
|
|
$hashedInteger = $integerToHash;
|
|
$hashedInteger *= $cryptMultiplyer;
|
|
$hashedInteger += $cryptConstant;
|
|
$hashedInteger %= $cryptPrime;
|
|
|
|
# run database.crypt.clean() after hased value is used
|
|
}
|
|
|
|
function clean() {
|
|
scoreboard players reset $integerToHash __variable__;
|
|
scoreboard players reset $hashInteger __variable__;
|
|
}
|
|
|
|
function test() {
|
|
test_hashInteger(1748586758492046);
|
|
}
|
|
}
|