cryptal  latest
Cryptography Abstraction Layer
fpoirotte\Cryptal\Padding\Zero Class Reference

Pads a string using NUL bytes, without ever creating a new block. More...

+ Inheritance diagram for fpoirotte\Cryptal\Padding\Zero:

Public Member Functions

 getPaddingData ($blockSize, $expectedSize)
 
 getPaddingSize ($paddedData, $blockSize)
 

Detailed Description

Pads a string using NUL bytes, without ever creating a new block.

Definition at line 8 of file Zero.php.

Member Function Documentation

fpoirotte\Cryptal\Padding\Zero::getPaddingData (   $blockSize,
  $expectedSize 
)

Return padding data to form a complete block.

Parameters
int$blockSizeThe cipher's block size, in bytes.
int$expectedSizeThe padding's expected size (in bytes) to form a (possibly new) complete block. This value is always such that: $ 0 < \$expectedSize <= \$blockSize $
Return values
stringPadding data.

Implements fpoirotte\Cryptal\PaddingInterface.

Definition at line 10 of file Zero.php.

fpoirotte\Cryptal\Padding\Zero::getPaddingSize (   $paddedData,
  $blockSize 
)

Return the size (in bytes) of the padding in some already-padded data.

Parameters
string$paddedDataThe padded data to analyze.
int$blockSizeThe cipher's block size, in bytes.
Exceptions
ExceptionAn exception is thrown when the supplied data is invalid (was not padded using the currently-selected scheme).
Warning
Some padding schemes can generate ambiguous data, resulting in possible data loss while removing the padding. This method suffers from the same shortcomings. If possible, you should not rely on this method to determine the plaintext's length. Instead, you should retrieve it using other means (eg. out-of-band communications).

Implements fpoirotte\Cryptal\PaddingInterface.

Definition at line 15 of file Zero.php.


The documentation for this class was generated from the following file: