AES

@perion/crypto. AES

A MapleStory implementation of AES-256-ECB

Constructor

new AES(iv, mapleVersion)

Source:

AES class constructor

Parameters:
Name Type Description
iv Buffer

The initialization vector

mapleVersion number

MapleStory version

Methods

(static) _morph(inputByte, newSequence, shiftKey) → {Buffer}

Source:

Morphs the input byte

Parameters:
Name Type Description
inputByte number

The input byte

newSequence Buffer

The new sequence

shiftKey Buffer

The shift key

Returns:

The modfied Buffer

Type
Buffer

(static) morphIV(iv, mapleVersion) → {Buffer}

Source:

Morphs the IV, called after the IV is used

Parameters:
Name Type Description
iv Buffer

The initialization vector

mapleVersion number

MapleStory version

Returns:

The new IV sequence

Type
Buffer

(static) scaleIV(iv, count, multiply) → {Buffer}

Source:

Scales the IV byte length by a multiplier

Parameters:
Name Type Description
iv Buffer

The initialization vector

count number

The byte count

multiply number

The amount to multiply

Returns:

Returns the scaled IV

Type
Buffer

_getPacketLength(header) → {number}

Source:

Gets the packet length using the header

Parameters:
Name Type Description
header number

The packet header as an int32

Returns:

The packet length

Type
number

_transform(data) → {Buffer}

Source:
Deprecated:
  • Yes

Old implementation of transform(data) Will morph the IV after use. Use transform(data) instead.

Parameters:
Name Type Description
data Buffer

The input data buffer

Returns:

Returns the transformed data

Type
Buffer

getPacketHeader(length) → {Buffer}

Source:

Generates the packet header using the current IV

Parameters:
Name Type Description
length number

The length of the packet data

Returns:

The packet header Buffer

Type
Buffer

transform(data) → {Buffer}

Source:

Transforms the data payload using the current IV Will morph the IV after use.

Parameters:
Name Type Description
data Buffer

The input data Buffer

Returns:

Returns the transformed data

Type
Buffer