Padding class abstract
Padding is a process to extend the input message to match a specific block size to be used in the cryptographic algorithms.
Reference: https://en.wikipedia.org/wiki/Padding_(cryptography)
Constructors
- Padding.new()
-
const
Properties
Methods
-
getPadLength(
List< int> block, [int? size]) → int -
Returns the padding length from the
block
according to the scheme. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pad(
List< int> block, int pos, [int? size]) → bool -
Apply the scheme to the input
block
. The padding is applied starting from thepos
to the end of theblock
. -
toString(
) → String -
A string representation of this object.
inherited
-
unpad(
List< int> block, [int? size]) → List<int> -
Returns the original message after removing padding from the
block
using the scheme.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- ansi → const _ANSIPadding
- This ANSI X9.23 standard padding consists of a sequence of zeros with the last byte set to the number of padding bytes added, including itself. If the input size is already a multiple of the block size, an extra block of padding is added.
- byte → const _BytePadding
-
This padding has
0x80
as the first byte followed by a sequence of zeros. It was originally defined as a communication standard for smart cards containing a file system in ISO/IEC 7816-4:2005. - none → const _NonePadding
- Does not apply any padding. The message size is always expected to be equal to the block size.
- pkcs5 → const _PKCS5Padding
- Same as pkcs7 padding scheme, except it is only defined for exactly 64-bit block. Primarily used with DES and other algorithms with an 8-byte block size.
- pkcs7 → const _PKCS7Padding
- Padding is in whole bytes. The value of each added byte is the number of bytes that are added. If the input size is already a multiple of the block size, an extra block of padding is added.
- zero → const _ZeroPadding
- Padding with zeros to match the block size.