diff options
author | rsiddharth <s@ricketyspace.net> | 2021-02-24 16:49:59 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2021-02-24 16:49:59 -0500 |
commit | f0521d8df2191956e1a2ab47860792dbfbf60d87 (patch) | |
tree | 92c409b8541591efe04cecd60012affa0ccb0bb9 /challenge | |
parent | c2a12c63b34f521c53b87dd7fcee7f379a69fb2f (diff) |
challenge/c05.go: refactor
Keep everything inside C5
Diffstat (limited to 'challenge')
-rw-r--r-- | challenge/c05.go | 10 | ||||
-rw-r--r-- | challenge/c06.go | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/challenge/c05.go b/challenge/c05.go index c794e15..a9b1682 100644 --- a/challenge/c05.go +++ b/challenge/c05.go @@ -5,18 +5,16 @@ 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() { + icebaby := `Burning 'em, if you ain't quick and nimble +I go crazy when I hear a cymbal` + key := "ICE" es := lib.RepeatingXOR(icebaby, key) hs := lib.AsciiStrToHexStr(es) - fmt.Printf("RepeatingXOR('%v', '%v') = %v\n", icebaby, key, hs) } diff --git a/challenge/c06.go b/challenge/c06.go index 9e0d81d..025a29f 100644 --- a/challenge/c06.go +++ b/challenge/c06.go @@ -29,7 +29,7 @@ func crack(bs []byte, ks int) (string, string) { blocks := lib.BreakIntoBlocks(bs, ks) blocks = lib.TransposeBlocks(blocks, ks) - key = "" + key := "" for i := 0; i < len(blocks); i++ { k := findKey(blocks[i]) |