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
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ abstract class TicketUser {
$authtoken = sprintf('%s%dx%s',
($this->isOwner() ? 'o' : 'c'),
$algo,
base64_encode(pack('VV',$this->getId(), $this->getTicketId())));
Base32::encode(pack('VV',$this->getId(), $this->getTicketId())));
switch($algo) {
case 1:
......@@ -72,7 +72,8 @@ abstract class TicketUser {
return null;
//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;
switch ($matches['type']) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment