Skip to content

Commit 9073e49

Browse files
authored
Use Endianness class in Adler32
Signed-off-by: Xen <lordofxen@deskasoft.com>
1 parent 5421da8 commit 9073e49

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

HashifyNet/Algorithms/Adler32/Adler32_Implementation.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,9 @@ protected override IHashValue FinalizeHashValueInternal(CancellationToken cancel
126126
// Combine s2 and s1 into the final 32-bit checksum
127127
uint finalValue = (_s2 << 16) | _s1;
128128

129-
// Convert to a big-endian byte array
130-
var hashValueBytes = new byte[4];
131-
hashValueBytes[0] = (byte)(finalValue >> 24);
132-
hashValueBytes[1] = (byte)(finalValue >> 16);
133-
hashValueBytes[2] = (byte)(finalValue >> 8);
134-
hashValueBytes[3] = (byte)finalValue;
135-
136-
return new HashValue(hashValueBytes, 32);
129+
return new HashValue(Endianness.GetBytesBigEndian(finalValue), 32);
137130
}
138131
}
139132
}
140-
}
133+
134+
}

0 commit comments

Comments
 (0)