From e285c8aa4a03b4f96b1ab36a0fd4b1a6e810ec4b Mon Sep 17 00:00:00 2001 From: siddharth Date: Sat, 19 Jun 2021 10:04:46 -0400 Subject: lib: update RepeatingXOR - Change input type to []byte. - Change retur type to []byte. - Update RepeatingXOR calls in challenge 5 an 6. --- challenge/c06.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'challenge/c06.go') diff --git a/challenge/c06.go b/challenge/c06.go index 589236b..5d19146 100644 --- a/challenge/c06.go +++ b/challenge/c06.go @@ -94,17 +94,17 @@ Jk8DCkkcC3hFMQIEC0EbAVIqCFZBO1IdBgZUVA4QTgUWSR4QJwwRTWM=` } // 'bs' is the data to decrypt. // 'ks' is the key size. - crack := func(bs []byte, ks int) (string, string) { + crack := func(bs []byte, ks int) ([]byte, []byte) { blocks := lib.BreakIntoBlocks(bs, ks) blocks = lib.TransposeBlocks(blocks, ks) - key := "" + key := make([]byte, 0) for i := 0; i < len(blocks); i++ { k := findKey(blocks[i]) - key += string(k) + key = append(key, k) } - return key, lib.RepeatingXOR(string(bs), key) + return key, lib.RepeatingXOR(bs, key) } // Compute keysize. -- cgit v1.2.3