SnapchatAgent::decryptECB PHP Method

decryptECB() public method

Decrypts blob data for standard images and videos.
public decryptECB ( data $data ) : data
$data data The data to decrypt.
return data The decrypted data.
    public function decryptECB($data)
    {
        return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, self::BLOB_ENCRYPTION_KEY, self::pad($data), MCRYPT_MODE_ECB);
    }

Usage Example

コード例 #1
0
ファイル: snapchat.php プロジェクト: sadiqhirani/php-snapchat
 /**
  * Downloads a snap.
  *
  * @param string $id
  *   The snap ID.
  *
  * @return mixed
  *   The snap data or FALSE on failure.
  */
 public function getMedia($id)
 {
     // Make sure we're logged in and have a valid access token.
     if (!$this->auth_token || !$this->username) {
         return FALSE;
     }
     $timestamp = parent::timestamp();
     $result = parent::post('/blob', array('id' => $id, 'timestamp' => $timestamp, 'username' => $this->username), array($this->auth_token, $timestamp));
     if (parent::isMedia(substr($result, 0, 2))) {
         return $result;
     } else {
         $result = parent::decryptECB($result);
         if (parent::isMedia(substr($result, 0, 2))) {
             return $result;
         }
     }
     return FALSE;
 }
All Usage Examples Of SnapchatAgent::decryptECB