BASE . LOG, 'log_file_id' => $LOG_FILE_ID, 'log_per_date' => true, ]); $hash_class = 'CoreLibs\Create\Hash'; // define a list of from to color sets for conversion test $PAGE_NAME = 'TEST CLASS: HASH'; print ""; print "" . $PAGE_NAME . ""; print ""; print '
Class Test Master
'; print '

' . $PAGE_NAME . '

'; $to_crc = 'Some text block'; // static print "S::__CRC32B: $to_crc: " . Hash::__crc32b($to_crc) . "
"; // print "S::__SHA1SHORT(off): $to_crc: " . Hash::__sha1short($to_crc) . "
"; print "S::hashShort(__sha1Short replace): $to_crc: " . Hash::hashShort($to_crc) . "
"; // print "S::__SHA1SHORT(on): $to_crc: " . Hash::__sha1short($to_crc, true) . "
"; print "S::sha1Short(__sha1Short replace): $to_crc: " . Hash::sha1Short($to_crc) . "
"; // print "S::__hash(d): " . $to_crc . "/" // . Hash::STANDARD_HASH_SHORT . ": " . $hash_class::__hash($to_crc) . "
"; $to_crc_list = [ 'Some text block', 'Some String Text', 'any string', ]; foreach ($to_crc_list as $__to_crc) { foreach (['adler32', 'fnv132', 'fnv1a32', 'joaat', 'ripemd160', 'sha256', 'sha512'] as $__hash_c) { print "Hash::hash($__hash_c): $__to_crc: " . Hash::hash($to_crc, $__hash_c) . "
"; } } // static use print "U-S::__CRC32B: $to_crc: " . Hash::__crc32b($to_crc) . "
"; echo "
"; $text = 'Some String Text'; // $text = 'any string'; $type = 'crc32b'; print "Hash: " . $type . ": " . hash($type, $text) . "
"; // print "Class (old): " . $type . ": " . Hash::__hash($text, $type) . "
"; print "Class (new): " . $type . ": " . Hash::hash($text, $type) . "
"; echo "
"; print "CURRENT STANDARD_HASH_SHORT: " . Hash::STANDARD_HASH_SHORT . "
"; print "CURRENT STANDARD_HASH_LONG: " . Hash::STANDARD_HASH_LONG . "
"; print "CURRENT STANDARD_HASH: " . Hash::STANDARD_HASH . "
"; print "HASH SHORT: " . $to_crc . ": " . Hash::hashShort($to_crc) . "
"; print "HASH LONG: " . $to_crc . ": " . Hash::hashLong($to_crc) . "
"; print "HASH DEFAULT: " . $to_crc . ": " . Hash::hashStd($to_crc) . "
"; echo "
"; $key = CreateKey::generateRandomKey(); $key = "FIX KEY"; print "Secret Key: " . $key . "
"; print "HASHMAC DEFAULT (fix): " . $to_crc . ": " . Hash::hashHmac($to_crc, $key) . "
"; $key = CreateKey::generateRandomKey(); print "Secret Key: " . $key . "
"; print "HASHMAC DEFAULT (random): " . $to_crc . ": " . Hash::hashHmac($to_crc, $key) . "
"; echo "
"; $hash_types = ['crc32b', 'sha256', 'invalid']; foreach ($hash_types as $hash_type) { echo "Checking $hash_type:
"; if (Hash::isValidHashType($hash_type)) { echo "hash type: $hash_type is valid
"; } else { echo "hash type: $hash_type is INVALID
"; } if (Hash::isValidHashHmacType($hash_type)) { echo "hash hmac type: $hash_type is valid
"; } else { echo "hash hmac type: $hash_type is INVALID
"; } } // print "UNIQU ID SHORT : " . Hash::__uniqId() . "
"; // print "UNIQU ID LONG : " . Hash::__uniqIdLong() . "
"; print ""; // __END__