crypto.MD5
MD5 object.
Constructor
crypto.MD5(): crypto.MD5Fields
| Name | Type | Description |
|---|---|---|
digest_size | integer | = 16 |
block_size | integer | = 64 |
digest | fun( message: string, as_hex: boolean? ): string |
Operators
| Operator | Operand | Result |
|---|---|---|
call | | crypto.MD5 |
Static functions
#crypto.MD5.digest
function crypto.MD5.digest(message: string, as_hex?: boolean): string
Computes the MD5 digest of the given input string.
This static method takes a string and returns its MD5 hash as a hexadecimal string. Commonly used for checksums, data integrity validation, and password hashing.
| Name | Type | Description |
|---|---|---|
message | string | The message to compute MD5 for. |
as_hexoptional | boolean | If true, the result will be a hex string. |
| Type | Name | Description |
|---|---|---|
string | str_result | The MD5 string of the message. |
Methods
digest | Calculates the MD5 digest based on the current state or input of the object. |
reset | Resets the MD5 object to its initial state. |
update | Updates the MD5 object with the given string. |
#MD5:digest
function crypto.MD5:digest(as_hex?: boolean): string
Calculates the MD5 digest based on the current state or input of the object.
This instance method returns the MD5 hash of the data associated with the object. Useful when the MD5 object has been incrementally updated with input data.
Does not change the state, so the object can be updated further.
| Name | Type | Description |
|---|---|---|
as_hexoptional | boolean | If true, the result will be a hex string. |
| Type | Name | Description |
|---|---|---|
string | str_result | The MD5 string of the message. |
#MD5:reset
function crypto.MD5:reset(): crypto.MD5
Resets the MD5 object to its initial state.
This instance method resets the MD5 object to its initial state.
It returns the MD5 object for method chaining.
| Type | Name | Description |
|---|---|---|
crypto.MD5 | obj | The reset MD5 object. |
#MD5:update
function crypto.MD5:update(str: string): crypto.MD5
Updates the MD5 object with the given string.
This instance method updates the MD5 object with the given string.
It returns the MD5 object for method chaining.
| Name | Type | Description |
|---|---|---|
str | string | The string to update the MD5 object with. |
| Type | Name | Description |
|---|---|---|
crypto.MD5 | obj | The updated MD5 object. |