src/Yubikey.php
public function parsePasswordOTP($str, $delim = '[:]')
    {
        if (!preg_match("/^((.*)" . $delim . ")?(([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{0,16})([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{32}))$/", $str, $matches)) {
            /* Dvorak? */
            if (!preg_match("/^((.*)" . $delim . ")?(([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{0,16})([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{32}))$/", $str, $matches)) {
                return false;
            } else {
                $ret['otp'] = strtr($matches[3], "jxe.uidchtnbpygk", "cbdefghijklnrtuv");
            }
        } else {
            $ret['otp'] = $matches[3];
        }

        $ret['password'] = $matches[2];
        $ret['prefix'] = $matches[4];
        $ret['ciphertext'] = $matches[5];

        return $ret;
    }
public function parsePasswordOTP($str, $delim = '[:]')
    {
        if (!preg_match("/^((.*)" . $delim . ")?(([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{0,16})([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{32}))$/", $str, $matches)) {
            /* Dvorak? */
            if (!preg_match("/^((.*)" . $delim . ")?(([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{0,16})([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{32}))$/", $str, $matches)) {
                return false;
            } else {
                $ret['otp'] = strtr($matches[3], "jxe.uidchtnbpygk", "cbdefghijklnrtuv");
            }
        } else {
            $ret['otp'] = $matches[3];
        }

        $ret['password'] = $matches[2];
        $ret['prefix'] = $matches[4];
        $ret['ciphertext'] = $matches[5];

        return $ret;
    }
public function parsePasswordOTP ( $ str , $ delim = '[:]' ) { if ( ! preg_match ( "/^((.*)" . $ delim . ")?(([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{0,16})([cbdefghijklnrtuvCBDEFGHIJKLNRTUV]{32}))$/" , $ str , $ matches ) ) { /* Dvorak? */ if ( ! preg_match ( "/^((.*)" . $ delim . ")?(([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{0,16})([jxe.uidchtnbpygkJXE.UIDCHTNBPYGK]{32}))$/" , $ str , $ matches ) ) { return false ; } else { $ ret [ 'otp' ] = strtr ( $ matches [ 3 ] , "jxe.uidchtnbpygk" , "cbdefghijklnrtuv" ) ; } } else { $ ret [ 'otp' ] = $ matches [ 3 ] ; } $ ret [ 'password' ] = $ matches [ 2 ] ; $ ret [ 'prefix' ] = $ matches [ 4 ] ; $ ret [ 'ciphertext' ] = $ matches [ 5 ] ; return $ ret ; }
Parse input string into password, yubikey prefix,
ciphertext, and OTP.

@param $str
@param string $delim
@return bool Keyed array with fields
@access public
Parse input string into password yubikey prefix ciphertext and OTP .