Skip to content

Instantly share code, notes, and snippets.

@auniverseaway
Created December 1, 2014 20:26
Show Gist options
  • Save auniverseaway/988b55885975762d8973 to your computer and use it in GitHub Desktop.
Save auniverseaway/988b55885975762d8973 to your computer and use it in GitHub Desktop.
public function getHash($hash)
{
$binary = $this->base64url_decode($hash);
$values = unpack("LS", $binary);
var_dump(bin2hex($binary));
var_dump($values);
$episodeId = $values['S'];
echo $episodeId;
//$timeCode = $values[1];
//$episode = Episode::find($episodeId);
//return View::make('episode/hash', compact('episode'));
}
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment