Sha1 class final

SHA-1 (FIPS 180-4) as an incremental hash.

Present for the formats that mandate it: WinZip AES (PBKDF2-HMAC-SHA1 and the HMAC-SHA1 authentication code) and the RAR4 key derivation, not as a general-purpose recommendation: SHA-1 is cryptographically broken for collision resistance. All arithmetic stays within unsigned 32-bit range (dart2js-exact).

Inheritance

Constructors

Sha1()
Creates a SHA-1 hash in its initial state.

Properties

digestSize int
Digest length in bytes (20 for SHA-1, 32 for SHA-256).
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Uint8List chunk, [int start = 0, int? end]) → void
Updates the hash with chunk[start..end).
inherited
compress(Uint8List block, int offset) → void
Compresses the 64 bytes at block[offset..offset+64) into the state.
override
copy() Sha1
Returns an independent copy of the running state.
override
finish() Uint8List
Pads, compresses the final block(s), and returns the digest. The hash cannot be updated afterwards; snapshot with copy first to continue a running stream.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
writeDigest(Uint8List out) → void
Writes the state words to out big-endian.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

compute(Uint8List data) Uint8List
Computes the SHA-1 digest of data in one call.