HashFunction

Methods
9
Fields
None

Getting one

Hashing.sha256()

Methods

MethodReturnsDescription
newHasher()Hasher(HashFunction) -> Hasher: A new Hasher, empty.
newHasher(number)Hasher
hashString(string, Charset)HashCodeThe hash of input's bytes in charset (input.getBytes(charset)).
hashUnencodedChars(string)HashCodeThe hash of input's UTF-16 code units, each little-endian (no charset).
hashInt(number)HashCodeThe hash of input's four bytes, little-endian.
hashLong(number)HashCodeThe hash of input's eight bytes, little-endian (exact below 2^53, as every Luau number is).
bits()numberThe number of bits a hash has: 256.
toString()stringHashing.sha256(), as Guava names the function.
equals(any)booleanWhether other equals this HashFunction, as == answers it (false for a value of another class).
hashBytes(string | {number})HashCode(HashFunction, string | {number}) -> HashCode: The hash of input's bytes (a Luau string of them, or an array of byte numbers): `Hashing…
hashBytes(string | {number}, number, number)HashCode

Returned by

MethodReturnsDescription
HashingClass.sha256HashFunctionSHA-256 (256 bits), the same function on every call.

Method details

newHasher

newHasher: ((HashFunction) -> Hasher) & ((HashFunction, number) -> Hasher)

(HashFunction) -> Hasher: A new Hasher, empty.

(HashFunction, number) -> Hasher: A new Hasher; expectedInputSize is a hint, and a negative one is IllegalArgumentException.

hashLong

hashLong: (HashFunction, number) -> HashCode

The hash of input's eight bytes, little-endian (exact below 2^53, as every Luau number is).

equals

equals: (HashFunction, any) -> boolean

Whether other equals this HashFunction, as == answers it (false for a value of another class).

hashBytes

hashBytes: ((HashFunction, string | {number}) -> HashCode) & ((HashFunction, string | {number}, number, number) -> HashCode)

(HashFunction, string | {number}) -> HashCode: The hash of input's bytes (a Luau string of them, or an array of byte numbers): Hashing.sha256():hashBytes(file:readBytes()) is Guava's Files.asByteSource(file).hash(Hashing.sha256()).

(HashFunction, string | {number}, number, number) -> HashCode: The hash of len bytes of input from index off (0-based); a range outside it is IndexOutOfBoundsException.