1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-14 23:33:18 +00:00

Padding size was incorrect -- didn't pad to multiples of 256

This commit is contained in:
Gilbert Chen
2018-11-03 11:42:03 -04:00
parent 244b797a1c
commit 21b3d9e57f
2 changed files with 9 additions and 4 deletions

View File

@@ -22,6 +22,8 @@ func TestChunk(t *testing.T) {
config.CompressionLevel = DEFAULT_COMPRESSION_LEVEL
maxSize := 1000000
remainderLength := -1
for i := 0; i < 500; i++ {
size := rand.Int() % maxSize
@@ -44,6 +46,12 @@ func TestChunk(t *testing.T) {
encryptedData := make([]byte, chunk.GetLength())
copy(encryptedData, chunk.GetBytes())
if remainderLength == -1 {
remainderLength = len(encryptedData) % 256
} else if len(encryptedData) % 256 != remainderLength {
t.Errorf("Incorrect padding size")
}
chunk.Reset(false)
chunk.Write(encryptedData)
err = chunk.Decrypt(key, "")