xftp: use SHA256 digest for file chunks to reduce file description size (#666)

* xftp: use SHA256 digest for file chunks to reduce file description size

* enable all tests
This commit is contained in:
Evgeny Poberezkin
2023-03-01 14:36:55 +00:00
committed by GitHub
parent faec32dc5e
commit 94de01a06f
4 changed files with 17 additions and 13 deletions

View File

@@ -352,7 +352,7 @@ cliSendFile SendOptions {filePath, outputDir, numRecipients, xftpServers, retryC
getChunkInfo sndKey XFTPChunkSpec {filePath = chunkPath, chunkOffset, chunkSize} =
withFile chunkPath ReadMode $ \h -> do
hSeek h AbsoluteSeek $ fromIntegral chunkOffset
digest <- LC.sha512Hash <$> LB.hGet h (fromIntegral chunkSize)
digest <- LC.sha256Hash <$> LB.hGet h (fromIntegral chunkSize)
pure FileInfo {sndKey, size = fromIntegral chunkSize, digest}
getXFTPServer :: TVar StdGen -> NonEmpty XFTPServerWithAuth -> IO XFTPServerWithAuth
getXFTPServer gen = \case