Hasher

Methods
12
Fields
None

Getting one

Hashing.sha256():newHasher()

Methods

MethodReturnsDescription
putByte(number)HasherFeed one byte: the low 8 bits of b.
putShort(number)HasherFeed a short: the low 16 bits of s, little-endian.
putInt(number)HasherFeed an int, little-endian.
putLong(number)HasherFeed a long, little-endian (exact below 2^53, as every Luau number is).
putFloat(number)HasherFeed a float: f rounded to single precision, its raw bits little-endian.
putDouble(number)HasherFeed a double: its raw bits, little-endian.
putBoolean(boolean)HasherFeed a boolean: one byte, 1 or 0.
putUnencodedChars(string)HasherFeed charSequence's UTF-16 code units, each little-endian (no charset).
putString(string, Charset)HasherFeed charSequence's bytes in charset.
hash()HashCodeThe hash of everything fed. Once: a second hash(), or a put after it, is IllegalStateException.
equals(any)booleanWhether other equals this Hasher, as == answers it (false for a value of another class).
putBytes(string | {number})Hasher(Hasher, string | {number}) -> Hasher: Feed bytes (a Luau string of them, or an array of byte numbers). Returns the hasher.
putBytes(string | {number}, number, number)Hasher

Returned by

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

Method details

putLong

putLong: (Hasher, number) -> Hasher

Feed a long, little-endian (exact below 2^53, as every Luau number is).

putFloat

putFloat: (Hasher, number) -> Hasher

Feed a float: f rounded to single precision, its raw bits little-endian.

hash

hash: (Hasher) -> HashCode

The hash of everything fed. Once: a second hash(), or a put after it, is IllegalStateException.

equals

equals: (Hasher, any) -> boolean

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

putBytes

putBytes: ((Hasher, string | {number}) -> Hasher) & ((Hasher, string | {number}, number, number) -> Hasher)

(Hasher, string | {number}) -> Hasher: Feed bytes (a Luau string of them, or an array of byte numbers). Returns the hasher.

(Hasher, string | {number}, number, number) -> Hasher: Feed len bytes of bytes from index off (0-based); a range outside it is IndexOutOfBoundsException. Returns the hasher.