Skip to content

Instantly share code, notes, and snippets.

@timmyRS
timmyRS / mcsha1.php
Last active January 20, 2023 02:27
Generates Minecraft-style SHA1 hashes in PHP.
<?php
/**
* Generates a Minecraft-style SHA1 hash.
* @param string $str
* @return string
*/
function mcsha1($str)
{
$gmp = gmp_import(sha1($str, true));
if(gmp_cmp($gmp, gmp_init("0x8000000000000000000000000000000000000000")) >= 0)
@timmyRS
timmyRS / prepend.php
Last active January 22, 2023 02:45
The perfect PHP error handler.
<?php
// This changes the error handler to a more helping one.
// You must/can prepend this script - Help: http://stackoverflow.com/a/35298767/4796321
function h_error($severity, $message, $file, $line)
{
if (!(error_reporting() & $severity))
{
return;
}
@timmyRS
timmyRS / False Positive Reporting E-Mails and Forms.md
Last active January 26, 2023 18:34
A list for quickly reporting false positives.