Skip to content

Instantly share code, notes, and snippets.

View e404's full-sized avatar

Gerald Schittenhelm e404

  • Error 404 - Not Found
View GitHub Profile
@e404
e404 / timecrypt.php
Last active August 29, 2015 14:02
PHP functions to encrypt/decrypt arbitrary data (binary safe) that gets devalued and useless after a specified amount of time. Useful e.g. for authorization tokens.
<?php
// Copyright 1012 Gerald Schittenhelm
// http://schittenhelm.at
// MIT License
function timecrypt($string,$key,$lifetime=3600) {
$key = md5($key);
$result = '';
for($i=0; $i<strlen ($string); $i++) {
@e404
e404 / VatID.php
Last active August 29, 2015 14:02
PHP class to check, unify and get information related to a european VAT ID.
<?php
// Copyright 1012 Gerald Schittenhelm
// http://schittenhelm.at
// MIT License
class VatID {
protected $findExp = '@vatResponseFormTable[^>]+>(.*?)</table>@s';
protected $vatId = "";