Class: AnsiX923

AnsiX923

Implements ANSI X.923 Padding functionality. Data is padded with zeros until the last byte, which is then set to the number of padded bytes. If the data length is already a "clean" multiple of the block length, it is still padded out to another block, so we can safely undo the padding afterwards.

new AnsiX923(data)

Creates a new AnsiX923 padding mode instance
Parameters:
Name Type Description
data Object Initialization options for the class, passed automatically into AnsiX923#initialize
Source:

Extends

Methods

do_pad(data) → {string}

Perform the padding on the data.
Parameters:
Name Type Description
data string A binary data string (ASCII)
Source:
Returns:
Padded data
Type
string

do_pad(data) → {string}

Perform the padding on the data.
Parameters:
Name Type Description
data string A binary data string (ASCII)
Source:
Returns:
Padded data
Type
string

initialize(data) → {PaddingMode}

Invoked during subclass instantiation. All properties needed to initialize the class must be passed in.
Parameters:
Name Type Description
data Object A list of properties used to initialize the class.
Properties
Name Type Description
cipher BlockCipher A reference to a BlockCipher subclass instance. Used to get information about the block size.
Inherited From:
Source:
Returns:
Type
PaddingMode

undo_pad(data) → {string}

Undo padding on padded data.
Parameters:
Name Type Description
data string A binary data string (ASCII)
Source:
Returns:
A binary string with the padding data stripped off the end.
Type
string

undo_pad(data) → {string}

Undo padding on padded data.
Parameters:
Name Type Description
data string A binary data string (ASCII)
Source:
Returns:
A binary string with the padding data stripped off the end.
Type
string