update buffer to 64kb

This commit is contained in:
davotoula
2025-10-26 00:09:17 +02:00
parent d01f6a2178
commit 4e31a9a5ac
3 changed files with 6 additions and 6 deletions

View File

@@ -32,12 +32,12 @@ actual fun sha256(data: ByteArray) = pool.hash(data)
* This is more efficient than reading the stream twice.
*
* @param inputStream The input stream to hash
* @param bufferSize Size of chunks to read (default 8KB)
* @param bufferSize Size of chunks to read (default 64KB)
* @return Pair of (hash bytes, bytes read count)
*/
fun sha256StreamWithCount(
inputStream: InputStream,
bufferSize: Int = 8192,
bufferSize: Int = 65536,
): Pair<ByteArray, Long> {
val countingStream = CountingInputStream(inputStream)
val hash = pool.hashStream(countingStream, bufferSize)

View File

@@ -37,12 +37,12 @@ class Sha256Hasher {
* This avoids loading the entire input into memory at once.
*
* @param inputStream The input stream to hash
* @param bufferSize Size of chunks to read (default 8KB)
* @param bufferSize Size of chunks to read (default 64KB)
* @return SHA256 hash bytes
*/
fun hashStream(
inputStream: InputStream,
bufferSize: Int = 8192,
bufferSize: Int = 65536,
): ByteArray {
val buffer = ByteArray(bufferSize)
try {

View File

@@ -61,12 +61,12 @@ class Sha256Pool(
* This avoids loading the entire input into memory at once.
*
* @param inputStream The input stream to hash
* @param bufferSize Size of chunks to read (default 8KB)
* @param bufferSize Size of chunks to read (default 64KB)
* @return SHA256 hash bytes
*/
fun hashStream(
inputStream: InputStream,
bufferSize: Int = 8192,
bufferSize: Int = 65536,
): ByteArray {
val hasher = acquire()
try {