dreamworkAPI
Ctrl K
GitHub
classDocs / crypto / SHA1

crypto.SHA1

classsharedmenusource
Object → crypto.SHA1

SHA1 object.

Constructor

crypto.SHA1(): crypto.SHA1

Fields

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

Operators

OperatorOperandResult
callcrypto.SHA1

Static functions

#crypto.SHA1.digest

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

Computes the SHA1 digest of the given input string.

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

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

Methods

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

#SHA1:digest

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

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

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

#SHA1:reset

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

Resets the SHA1 object to its initial state.

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

It returns the SHA1 object for method chaining.

Returns
TypeNameDescription
crypto.SHA1objThe reset SHA1 object.

#SHA1:update

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

Updates the SHA1 object with the given string.

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

It returns the SHA1 object for method chaining.

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