summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--challenge/c10.go25
1 files changed, 13 insertions, 12 deletions
diff --git a/challenge/c10.go b/challenge/c10.go
index bc65780..5e208ee 100644
--- a/challenge/c10.go
+++ b/challenge/c10.go
@@ -8,6 +8,15 @@ import (
"ricketyspace.net/cryptopals/lib"
)
+var cipher80038A = lib.HexStrToBytes("7649abac8119b246cee98e9b12e9197d" +
+ "5086cb9b507219ee95db113a917678b2" +
+ "73bed6b8e3c1743b7116e69e22229516" +
+ "3ff1caa1681fac09120eca307586e1a7")
+
+var key80038A = lib.HexStrToBytes("2b7e151628aed2a6abf7158809cf4f3c")
+
+var iv80038A = lib.HexStrToBytes("000102030405060708090a0b0c0d0e0f")
+
var cipher10 string = `CRIwqt4+szDbqkNY+I0qbNXPg1XLaCM5etQ5Bt9DRFV/xIN2k8Go7jtArLIy
P605b071DL8C+FPYSHOXPkMMMFPAKm+Nsu0nCBMQVt9mlluHbVE/yl6VaBCj
NuOGvHZ9WYvt51uR/lklZZ0ObqD5UaC1rupZwCEK4pIWf6JQ4pTyPjyiPtKX
@@ -84,20 +93,12 @@ func init() {
}
func C10() {
- c := []byte{
- 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d,
- 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2,
- 0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b, 0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16,
- 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7,
- }
- k := []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}
- iv := []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}
- o := lib.AESDecryptCBC(c, k, iv)
+ o := lib.AESDecryptCBC(cipher80038A, key80038A, iv80038A)
fmt.Printf("NIST SP 800-38A F.2.2:%v\n", lib.BytesToHexStr(o))
- c = lib.Base64ToBytes(cipher10)
- k = lib.StrToBytes(key10)
- iv = iv10
+ c := lib.Base64ToBytes(cipher10)
+ k := lib.StrToBytes(key10)
+ iv := iv10
o = lib.AESDecryptCBC(c, k, iv)
fmt.Printf("\nCryptopals Ch. 10:\n%v", lib.BytesToStr(o))