summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--challenge/c01.go4
-rw-r--r--challenge/c02.go4
-rw-r--r--lib/b64.go (renamed from enc/b64.go)2
-rw-r--r--lib/hex.go (renamed from enc/hex.go)2
-rw-r--r--lib/xor.go (renamed from enc/xor.go)2
6 files changed, 8 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index fd91059..2abddd3 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ build: fmt
go build
fmt:
- go fmt -x ${MOD} ${MOD}/challenge ${MOD}/enc
+ go fmt -x ${MOD} ${MOD}/challenge ${MOD}/lib
clean:
go clean
diff --git a/challenge/c01.go b/challenge/c01.go
index b7f5a4d..656a859 100644
--- a/challenge/c01.go
+++ b/challenge/c01.go
@@ -5,12 +5,12 @@ package challenge
import (
"fmt"
- "ricketyspace.net/cryptopals/enc"
+ "ricketyspace.net/cryptopals/lib"
)
func C1() {
hex := "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
- b64 := enc.HexToBase64(hex)
+ b64 := lib.HexToBase64(hex)
fmt.Printf("b64(0x%v) = %v\n", hex, b64)
}
diff --git a/challenge/c02.go b/challenge/c02.go
index d8f03c9..eb45a4f 100644
--- a/challenge/c02.go
+++ b/challenge/c02.go
@@ -5,13 +5,13 @@ package challenge
import (
"fmt"
- "ricketyspace.net/cryptopals/enc"
+ "ricketyspace.net/cryptopals/lib"
)
func C2() {
a := "1c0111001f010100061a024b53535009181c"
b := "686974207468652062756c6c277320657965"
- c := enc.FixedXOR(a, b)
+ c := lib.FixedXOR(a, b)
fmt.Printf("XOR(%v ^ %v) = %v\n", a, b, c)
}
diff --git a/enc/b64.go b/lib/b64.go
index 4c251a2..d37f710 100644
--- a/enc/b64.go
+++ b/lib/b64.go
@@ -1,7 +1,7 @@
// Copyright © 2020 rsiddharth <s@ricketyspace.net>
// SPDX-License-Identifier: ISC
-package enc
+package lib
const b64_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
diff --git a/enc/hex.go b/lib/hex.go
index a1b9b46..bf539bc 100644
--- a/enc/hex.go
+++ b/lib/hex.go
@@ -1,7 +1,7 @@
// Copyright © 2020 rsiddharth <s@ricketyspace.net>
// SPDX-License-Identifier: ISC
-package enc
+package lib
// Adapted from
// https://go.googlesource.com/go/+/refs/tags/go1.15/src/encoding/hex/hex.go#83
diff --git a/enc/xor.go b/lib/xor.go
index fe412b2..270999c 100644
--- a/enc/xor.go
+++ b/lib/xor.go
@@ -1,7 +1,7 @@
// Copyright © 2020 rsiddharth <s@ricketyspace.net>
// SPDX-License-Identifier: ISC
-package enc
+package lib
func FixedXOR(a, b string) string {
cs := ""