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