From 3b0fb163cbac08a36b01f186b72e2a9cee4b7a2d Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 29 Aug 2020 20:00:53 -0400 Subject: challenge: do challenge 3 * challenge/c03.go: Implement challenge 3 * cryptopals.go (main): Add handling to run challenge 3 * lib/brute.go (XORCrackSingleKey): New function. * lib/hex.go (HexStrToAsciiStr, ByteToHexStr): New functions. * lib/str.go (FillStr): New function. --- challenge/c03.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 challenge/c03.go (limited to 'challenge') diff --git a/challenge/c03.go b/challenge/c03.go new file mode 100644 index 0000000..019aaff --- /dev/null +++ b/challenge/c03.go @@ -0,0 +1,17 @@ +// Copyright © 2020 rsiddharth +// SPDX-License-Identifier: ISC + +package challenge + +import ( + "fmt" + "ricketyspace.net/cryptopals/lib" +) + +func C3() { + hs := "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736" + k, ds, scr := lib.XORCrackSingleKey(hs) + + fmt.Printf("Key is '%c' (Score: %v)\n", k, scr) + fmt.Printf("Decrypted string: %v\n", ds) +} -- cgit v1.2.3