dreamworkAPI
Ctrl K
GitHub
classDocs / crypto / SHA256

crypto.SHA256

classsharedmenusource
Object → crypto.SHA256

SHA256 object.

Constructor

crypto.SHA256(): crypto.SHA256

Fields

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

Operators

OperatorOperandResult
callcrypto.SHA256

Static functions

#crypto.SHA256.digest

sharedmenunodiscardsource
function crypto.SHA256.digest(message: string, as_hex?: boolean): string

Computes the SHA256 digest of the given input string.

This static method takes a string and returns its SHA256 hash as a hexadecimal string. Commonly used for checksums, data integrity validation, and password hashing.

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

Methods

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

#SHA256:digest

sharedmenunodiscardsource
function crypto.SHA256:digest(as_hex?: boolean): string

Calculates the SHA256 digest based on the current state or input of the object.

This instance method returns the SHA256 hash of the data associated with the object. Useful when the SHA256 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 SHA256 string of the message.

#SHA256:reset

sharedmenusource
function crypto.SHA256:reset(): crypto.SHA256

Resets the SHA256 object to its initial state.

This instance method resets the SHA256 object to its initial state.

It returns the SHA256 object for method chaining.

Returns
TypeNameDescription
crypto.SHA256objThe reset SHA256 object.

#SHA256:update

sharedmenusource
function crypto.SHA256:update(str: string): crypto.SHA256

Updates the SHA256 object with the given string.

This instance method updates the SHA256 object with the given string.

It returns the SHA256 object for method chaining.

Parameters
NameTypeDescription
strstringThe string to update the SHA256 object with.
Returns
TypeNameDescription
crypto.SHA256objThe updated SHA256 object.
Generated from the dreamwork meta branch.