summaryrefslogtreecommitdiffstats
path: root/challenge/c05.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-08-30 20:15:58 -0400
committerrsiddharth <s@ricketyspace.net>2020-08-30 20:15:58 -0400
commitc1240b472934f0b7649922722fe0d61c0c1c6cac (patch)
tree2e35f187c5caf7e81486465cfe1170ef1ce0b0e6 /challenge/c05.go
parent60cd4c5cedf546c282b2bcb0f959596d4ed364a3 (diff)
challenge: do challenge 5
* challenge/c05.go: Implement challenge 5. * cryptopals.go (main): Add handling to run challenge 5. * lib/hex.go (BytesToHexStr): New function. * lib/xor.go (RepeatingXOR): New function.
Diffstat (limited to 'challenge/c05.go')
-rw-r--r--challenge/c05.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge/c05.go b/challenge/c05.go
new file mode 100644
index 0000000..7f22663
--- /dev/null
+++ b/challenge/c05.go
@@ -0,0 +1,21 @@
+// Copyright © 2020 rsiddharth <s@ricketyspace.net>
+// SPDX-License-Identifier: ISC
+
+package challenge
+
+import (
+ "fmt"
+ "ricketyspace.net/cryptopals/lib"
+)
+
+var icebaby string = `Burning 'em, if you ain't quick and nimble
+I go crazy when I hear a cymbal`
+
+var key string = "ICE"
+
+func C5() {
+ es := lib.RepeatingXOR(icebaby, key)
+ hs := lib.BytesToHexStr([]byte(es))
+
+ fmt.Printf("RepeatingXOR('%v', '%v') = %v\n", icebaby, key, hs)
+}