dreamworkAPI
Ctrl K
GitHub
classDocs / crypto / SHA512

crypto.SHA512

classsharedmenusource
Object → crypto.SHA512

SHA512 object.

Constructor

crypto.SHA512(): crypto.SHA512

Fields

NameTypeDescription
digest_sizeinteger = 64
block_sizeinteger = 128
digestfun( message: string, as_hex: boolean? ): string

Operators

OperatorOperandResult
callcrypto.SHA512

Static functions

#crypto.SHA512.digest

sharedmenunodiscardsource
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.

Parameters
NameTypeDescription
messagestringThe message to compute SHA512 for.
as_hexoptionalbooleanIf true, the result will be a hex string.
Returns
TypeNameDescription
stringstr_resultThe SHA512 string of the message.

Methods

digestCalculates the SHA512 digest based on the current state or input of the object.
resetResets the SHA512 object to its initial state.
updateUpdates the SHA512 object with the given string.

#SHA512:digest

sharedmenunodiscardsource
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.

Parameters
NameTypeDescription
as_hexoptionalbooleanIf true, the result will be a hex string.
Returns
TypeNameDescription
stringstr_resultThe SHA512 string of the message.

#SHA512:reset

sharedmenusource
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.

Returns
TypeNameDescription
crypto.SHA512objThe reset SHA512 object.

#SHA512:update

sharedmenusource
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.

Parameters
NameTypeDescription
strstringThe string to update the SHA512 object with.
Returns
TypeNameDescription
crypto.SHA512objThe updated SHA512 object.

Subclasses

crypto.SHA384

Generated from the dreamwork meta branch.