@@ -41,7 +41,7 @@ export class Hasher {
4141
4242 /** Append bytes to the hasher. */
4343 write ( bytes : Uint8Array ) : this {
44- const { buffer, offset , layers } = this
44+ const { buffer, layers } = this
4545 const leaves = layers [ 0 ]
4646 const { length } = bytes
4747
@@ -51,16 +51,16 @@ export class Hasher {
5151 }
5252
5353 // Not enough for a quad yet: stash in the buffer.
54- if ( offset + length < buffer . length ) {
55- buffer . set ( bytes , offset )
54+ if ( this . offset + length < buffer . length ) {
55+ buffer . set ( bytes , this . offset )
5656 this . offset += length
5757 this . bytesWritten += BigInt ( length )
5858 return this
5959 }
6060
6161 // Fill the buffer to complete a quad, then process whole quads from `bytes`.
62- const bytesRequired = buffer . length - offset
63- buffer . set ( bytes . subarray ( 0 , bytesRequired ) , offset )
62+ const bytesRequired = buffer . length - this . offset
63+ buffer . set ( bytes . subarray ( 0 , bytesRequired ) , this . offset )
6464 leaves . push ( ...split ( fr32Expand ( buffer ) ) )
6565
6666 let readOffset = bytesRequired
@@ -88,14 +88,14 @@ export class Hasher {
8888 }
8989
9090 private digestInto ( output : Uint8Array , byteOffset : number , asMultihash : boolean ) : number {
91- const { buffer, layers, offset , bytesWritten } = this
91+ const { buffer, layers, bytesWritten } = this
9292
9393 // Snapshot the layers so we don't mutate hasher state.
9494 let [ leaves , ...nodes ] = layers
9595
9696 // If there's a partial quad in the buffer, zero-pad and absorb it.
97- if ( offset > 0 || bytesWritten === 0n ) {
98- leaves = [ ...leaves , ...split ( fr32Expand ( buffer . fill ( 0 , offset ) ) ) ]
97+ if ( this . offset > 0 || bytesWritten === 0n ) {
98+ leaves = [ ...leaves , ...split ( fr32Expand ( buffer . fill ( 0 , this . offset ) ) ) ]
9999 }
100100
101101 const tree = build ( [ leaves , ...nodes ] )
0 commit comments