Skip to content
nf404 edited this page Dec 14, 2015 · 24 revisions

Classes

CryptoApi

Main class

BaseHasher
BaseMacBaseHasher
BaseEncode

Encode HashArray

Hashers

Collection of hashers

Encodes

Collection of encodes

Macs

Collection of macs

Tools

Helper with some methods

HashArray

Array of hash bytes

HexBaseEncode

Hex encode

Md2BaseHasher

Md2 hasher

Md4BaseHasher

Md4 hasher

Md5BaseHasher

Md5 hasher

Sha0BaseHasher

Sha0 hasher

Sha1BaseHasher

Sha1 hasher

Sha256BaseHasher

Sha256 hasher

HmacBaseMac

HMAC

## HasherInterface **Kind**: global interface **Access:** public

hasherInterface.constructor

Kind: instance class of HasherInterface

HasherInterface.processBlock(block)

Process ready block

Kind: static method of HasherInterface

Param Type
block Array.<number>

HasherInterface.update(message) ⇒ HasherInterface

Update message

Kind: static method of HasherInterface

Param Type
message string | Array.<number>

HasherInterface.finalize() ⇒ HashArray

Process last block and return hash

Kind: static method of HasherInterface
Returns: HashArray - hash

MacInterface

Kind: global interface
Access: public

macInterface.constructor

Kind: instance class of MacInterface

new MacInterface.prototype.constructor(key, hasher, options)

Param Type
key string | Array.<number>
hasher string
options Object

MacInterface.processBlock(block)

Process ready block

Kind: static method of MacInterface

Param Type
block Array.<number>

MacInterface.update(message) ⇒ MacInterface

Update message

Kind: static method of MacInterface

Param Type
message string | Array.<number>

MacInterface.finalize() ⇒ HashArray

Process last block and return hash

Kind: static method of MacInterface
Returns: HashArray - hash

EncodeInterface

Kind: global interface
Access: public

encodeInterface.constructor

Kind: instance class of EncodeInterface

new EncodeInterface.prototype.constructor(hash)

Param Type
hash HashArray

EncodeInterface.stringify() ⇒ string

Stringify hash

Kind: static method of EncodeInterface

CryptoApi

Main class

Kind: global class
Access: public

CryptoApi.BaseHasher : BaseHasher

Kind: static property of CryptoApi

CryptoApi.BaseMac : BaseMac

Kind: static property of CryptoApi

CryptoApi.BaseEncode : BaseEncode

Kind: static property of CryptoApi

CryptoApi.hash(algo, message, options) ⇒ HashArray

Hash message with algo

Kind: static method of CryptoApi
Returns: HashArray - hash
Access: public

Param Type
algo string
message string
options Object

CryptoApi.hasher(algo, options) ⇒ HasherInterface

Get new Hasher object

Kind: static method of CryptoApi
Access: public

Param Type
algo string
options Object

CryptoApi.mac(algo, key, hasher, options) ⇒ MacInterface

Get new MAC object

Kind: static method of CryptoApi
Access: public

Param Type
algo string
key string | Array.<number>
hasher string
options Object

CryptoApi.hashArray(hash) ⇒ HashArray

Get new HashArray

Kind: static method of CryptoApi
Access: public

Param Type
hash Array.<number>

BaseHasher

Kind: global class
Access: public

new BaseHasher(name, options)

Param Type
name string
options Object

baseHasher.state.message : Array.<number>

Unprocessed Message

Kind: instance property of BaseHasher

baseHasher.state.length : number

Length of message

Kind: instance property of BaseHasher

baseHasher.state.options : Object

Kind: instance property of BaseHasher

BaseHasher.unitSize : number

Size of unit in bytes (4 = 32 bits)

Kind: static property of BaseHasher

BaseHasher.unitOrder : number

Bytes order in unit 0 - normal 1 - reverse

Kind: static property of BaseHasher

BaseHasher.blockSize : number

Size of block in units

Kind: static property of BaseHasher

BaseHasher.getState() ⇒ Object

Return current state

Kind: static method of BaseHasher

BaseHasher.setState(state) ⇒ BaseHasher

Set state

Kind: static method of BaseHasher

Param Type
state Object

BaseHasher.update(message) ⇒ BaseHasher

Update message

Kind: static method of BaseHasher

Param Type
message string | Array.<number>

BaseHasher.process()

Process ready blocks

Kind: static method of BaseHasher

BaseMac ⇐ BaseHasher

Kind: global class
Extends: BaseHasher
Access: public

new BaseMac(key, hasher, options)

Param Type
key string | Array.<number>
hasher string
options Object

baseMac.state.message : Array.<number>

Unprocessed Message

Kind: instance property of BaseMac

baseMac.state.length : number

Length of message

Kind: instance property of BaseMac

baseMac.state.options : Object

Kind: instance property of BaseMac

BaseEncode

Encode HashArray

Kind: global class
Access: public

new BaseEncode(hash)

Param Type
hash HashArray

baseEncode.constructor

Kind: instance class of BaseEncode

new BaseEncode.prototype.constructor(hash)

Param Type
hash HashArray

constructor.hash : HashArray

Kind: instance property of constructor
Properties

Name
hash

Hashers

Collection of hashers

Kind: global class

Hashers.add(name, hasher)

Kind: static method of Hashers

Param Type
name string
hasher HasherInterface

Hashers.add(name, options) ⇒ HasherInterface

Kind: static method of Hashers

Param Type
name string
options Object

Encodes

Collection of encodes

Kind: global class

Encodes.add(name, encode)

Kind: static method of Encodes

Param Type
name string
encode BaseEncode

Encodes.get(name, hash) ⇒ BaseEncode

Kind: static method of Encodes

Param Type
name string
hash HashArray

Macs

Collection of macs

Kind: global class

Macs.add(name, mac)

Kind: static method of Macs

Param Type
name string
mac BaseMac

Macs.get(name, key, hasher, options) ⇒ MacInterface

Kind: static method of Macs

Param Type
name string
key string | Array.<number>
hasher string
options Object

Tools

Helper with some methods

Kind: global class

Tools.rotateLeft(x, n) ⇒ number

Rotate x to n bits left

Kind: static method of Tools

Param Type
x number
n number

Tools.rotateLeft(x, n) ⇒ number

Rotate x to n bits right

Kind: static method of Tools

Param Type
x number
n number

HashArray

Array of hash bytes

Kind: global class
Access: public
Instanceof: Array

new HashArray(hash, Encodes)

Param Type
hash Array.<number>
Encodes Encodes

Hex ⇐ BaseEncode

Hex encode

Kind: global class
Extends: BaseEncode
Implements: EncodeInterface

new Hex(hash)

Param Type
hash HashArray

hex.constructor

Kind: instance class of Hex
Implements: constructor

new BaseEncode.prototype.constructor(hash)

Param Type
hash HashArray

Hex.stringify() ⇒ string

Kind: static method of Hex

Md2 ⇐ BaseHasher

Md2 hasher

Kind: global class
Extends: BaseHasher
Implements: HasherInterface

new Hmac#constructor(key, hasher, options)

Param Type
key string | Array.<number>
hasher string
options Object

md2.constructor

Kind: instance class of Md2
Implements: constructor

md2.piSubst : Array.<number>

Constants from Pi

Kind: instance property of Md2
Link: https://github.com/e-sushi/MD2-S-box-creator

md2.unitSize : number

Size of unit = 1 byte

Kind: instance property of Md2

md2.hasher : HasherInterface

Hasher instance

Kind: instance property of Md2
Properties

Name
hasher

md2.key : Array.<number>

Kind: instance property of Md2
Properties

Name
key

md2.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Md2

md2.state.length : number

Length of message

Kind: instance property of Md2

md2.state.options : Object

Kind: instance property of Md2

Md2.processBlock(block)

Kind: static method of Md2

Param Type
block Array.<number>

Md2.finalize() ⇒ HashArray

Kind: static method of Md2

Md4 ⇐ BaseHasher

Md4 hasher

Kind: global class
Extends: BaseHasher
Implements: HasherInterface

md4.constructor

Kind: instance class of Md4
Implements: constructor

md4.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Md4

md4.state.length : number

Length of message

Kind: instance property of Md4

md4.state.options : Object

Kind: instance property of Md4

Md4.S : Array.<number>

Transform constants

Kind: static constant of Md4

Md5 ⇐ BaseHasher

Md5 hasher

Kind: global class
Extends: BaseHasher
Implements: HasherInterface

md5.constructor

Kind: instance class of Md5
Implements: constructor

md5.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Md5

md5.state.length : number

Length of message

Kind: instance property of Md5

md5.state.options : Object

Kind: instance property of Md5

Sha0 ⇐ BaseHasher

Sha0 hasher

Kind: global class
Extends: BaseHasher
Implements: HasherInterface

sha0.constructor

Kind: instance class of Sha0
Implements: constructor

sha0.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Sha0

sha0.state.length : number

Length of message

Kind: instance property of Sha0

sha0.state.options : Object

Kind: instance property of Sha0

Sha1 ⇐ BaseHasher

Sha1 hasher

Kind: global class
Extends: BaseHasher
Implements: HasherInterface

sha1.constructor

Kind: instance class of Sha1
Implements: constructor

sha1.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Sha1

sha1.state.length : number

Length of message

Kind: instance property of Sha1

sha1.state.options : Object

Kind: instance property of Sha1

Sha256 ⇐ BaseHasher

Sha256 hasher

Kind: global class
Extends: BaseHasher
Implements: HasherInterface

new Sha256(name, options)

Param Type
name string
options Object

sha256.constructor

Kind: instance class of Sha256
Implements: constructor

new Sha256.prototype.constructor(name, options)

Param Type
name string
options Object

sha256.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Sha256

sha256.state.length : number

Length of message

Kind: instance property of Sha256

sha256.state.options : Object

Kind: instance property of Sha256

Hmac ⇐ BaseMac

HMAC

Kind: global class
Extends: BaseMac
Implements: MacInterface

hmac.state.message : Array.<number>

Unprocessed Message

Kind: instance property of Hmac

hmac.state.length : number

Length of message

Kind: instance property of Hmac

hmac.state.options : Object

Kind: instance property of Hmac

Hmac.update(message) ⇒ BaseHasher

Update message

Kind: static method of Hmac

Param Type
message string | Array.<number>

Hmac.processBlock(block)

Kind: static method of Hmac

Param Type
block Array.<number>

Hmac.finalize() ⇒ HashArray

Kind: static method of Hmac

Clone this wiki locally