CryptoCommon
Contains the common base class for cryptographic hash libraries
- namespace CryptoCommon
class AbstractHash[link]
The abstract base class for the cryptographic hashes in other libraries, such as SHA1. Contains the common methods for adding data to the hash and generating a digest.
function addByte(value)[link]
Adds a single byte value to the hash.
Arguments
Name | Type | Description |
---|---|---|
value | integer | A byte value from 0 to 255 (signed bytes from -128 to -1 are also allowed). |
Return Value
Type | Description |
---|---|
CryptoCommon.AbstractHash | A reference to itself to allow chaining syntax. |
function addInteger(value)[link]
Adds an integer to the hash. The integer is converted into 32-bit signed Big Endian bytes.
Arguments
Name | Type | Description |
---|---|---|
value | integer | An integer value |
Return Value
Type | Description |
---|---|
CryptoCommon.AbstractHash | A reference to itself to allow chaining syntax. |
function addText(value, encoding)[link]
Adds the string as text to the current hash.
Arguments
Name | Type | Optional | Description |
---|---|---|---|
value | string | A text value to add to the hash. |
|
encoding | TextEncoding.TextFormat | Optional | Because cryptographic hashes work with bytes, a string must have an encoding to convert to binary data. If not specified, UTF8 is used. |
Return Value
Type | Description |
---|---|
CryptoCommon.AbstractHash | A reference to itself to allow chaining syntax. |
function digestByteList()[link]
Digests the current data into a list of bytes.
Return Value
Type | Description |
---|---|
int list | A list of bytes from 0 to 255 |
function digestHex()[link]
Digests the current data into a (lowercase) hexadecimal string.
Return Value
Type | Description |
---|---|
string | A hexadecimal hash value |