lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
private function getResponse($secret, $challenge)
    {
        if (strlen($secret) > 64) {
            $secret = pack('H32', md5($secret));
        }

        if (strlen($secret) < 64) {
            $secret = str_pad($secret, 64, chr(0));
        }

        $k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64);
        $k_opad = substr($secret, 0, 64) ^ str_repeat(chr(0x5C), 64);

        $inner = pack('H32', md5($k_ipad.$challenge));
        $digest = md5($k_opad.$inner);

        return $digest;
    }
private function getResponse($secret, $challenge)
    {
        if (strlen($secret) > 64) {
            $secret = pack('H32', md5($secret));
        }

        if (strlen($secret) < 64) {
            $secret = str_pad($secret, 64, chr(0));
        }

        $k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64);
        $k_opad = substr($secret, 0, 64) ^ str_repeat(chr(0x5C), 64);

        $inner = pack('H32', md5($k_ipad.$challenge));
        $digest = md5($k_opad.$inner);

        return $digest;
    }
private function getResponse ( $ secret , $ challenge ) { if ( strlen ( $ secret ) > 64 ) { $ secret = pack ( 'H32' , md5 ( $ secret ) ) ; } if ( strlen ( $ secret ) < 64 ) { $ secret = str_pad ( $ secret , 64 , chr ( 0 ) ) ; } $ k_ipad = substr ( $ secret , 0 , 64 ) ^ str_repeat ( chr ( 0x36 ) , 64 ) ; $ k_opad = substr ( $ secret , 0 , 64 ) ^ str_repeat ( chr ( 0x5C ) , 64 ) ; $ inner = pack ( 'H32' , md5 ( $ k_ipad . $ challenge ) ) ; $ digest = md5 ( $ k_opad . $ inner ) ; return $ digest ; }
Generate a CRAM-MD5 response from a server challenge.

@param string $secret
@param string $challenge

@return string
Generate a CRAM - MD5 response from a server challenge .