Skip to content
Snippets Groups Projects
Commit 156d5c4d authored by Peter Rotich's avatar Peter Rotich
Browse files

Use base32 encoding/decoding for authcodes

parent edc70aa1
Branches
Tags
No related merge requests found
...@@ -50,7 +50,7 @@ abstract class TicketUser { ...@@ -50,7 +50,7 @@ abstract class TicketUser {
$authtoken = sprintf('%s%dx%s', $authtoken = sprintf('%s%dx%s',
($this->isOwner() ? 'o' : 'c'), ($this->isOwner() ? 'o' : 'c'),
$algo, $algo,
base64_encode(pack('VV',$this->getId(), $this->getTicketId()))); Base32::encode(pack('VV',$this->getId(), $this->getTicketId())));
switch($algo) { switch($algo) {
case 1: case 1:
...@@ -72,7 +72,8 @@ abstract class TicketUser { ...@@ -72,7 +72,8 @@ abstract class TicketUser {
return null; return null;
//Unpack the user and ticket ids //Unpack the user and ticket ids
$matches +=unpack('Vuid/Vtid', base64_decode(substr($matches['hash'], 0, 12))); $matches +=unpack('Vuid/Vtid',
Base32::decode(strtolower(substr($matches['hash'], 0, 13))));
$user = null; $user = null;
switch ($matches['type']) { switch ($matches['type']) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment