public static function serial($id, $unique = true, $upper = true, $length = 25, $portion = 5)
    {
        // If unique is defined
        if ($unique === true) {
            $salt = substr(sha1(mt_rand()), 0, 20);
            $id .= $salt;
        }

        // MD5 is great enough
        $hash = md5($id);

        // Make the hash more unique
        for ($i = 0; $i < 10; $i++) {
            $hash = md5($hash);
        }

        if ($upper === true) {
            $hash = strtoupper($hash);
        }

        return implode('-', str_split(substr($hash, 0, $length), $portion));
    }