summaryrefslogtreecommitdiff
path: root/src/solvers
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2014-11-28 03:40:17 -0800
committeriximeow <me@iximeow.net>2014-11-28 03:40:17 -0800
commit6268e2c446d6d54b43668d859184d6f3a779fa3a (patch)
treec9333b6130f0032b33bdd54194e3e41be62cf6b4 /src/solvers
parent409e8109d8076058e4f154272270a79b6844da18 (diff)
Fix challenge 10 specs
Diffstat (limited to 'src/solvers')
-rw-r--r--src/solvers/Challenge10.scala19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/solvers/Challenge10.scala b/src/solvers/Challenge10.scala
index 7880327..abc99f9 100644
--- a/src/solvers/Challenge10.scala
+++ b/src/solvers/Challenge10.scala
@@ -2,6 +2,7 @@ package ixee.cryptopals.solvers
import scala.io.Source
import ixee.cryptopals.utils.ByteUtils._
+import ixee.cryptopals.utils.CryptoUtils._
import ixee.cryptopals.utils.StreamUtils._
import ixee.cryptopals.utils.ConversionUtils._
import ixee.cryptopals.utils.FunctionUtils._
@@ -21,23 +22,9 @@ object Challenge10 {
.toByteArray
def run = {
- def cbcBuilder = SchemeBuilder("AES", "YELLOW SUBMARINE".asBytes)
+ def builder = SchemeBuilder("AES", "YELLOW SUBMARINE".asBytes)
.cbc(Stream.continually(0.toByte).take(16))
- val encInstance = cbcBuilder.encrypt
- val decInstance = cbcBuilder.decrypt
-
- val s = "fooo bar frobnicator the quick brown fox jumps over the lazy dog".asBytes
-
- println(s)
- val enc = encInstance.end(s)
- val dec = decInstance.end(enc)
- println(enc)
- println(dec)
- println(dec.startsWith(s))
-
- val decInstance2 = cbcBuilder.decrypt
-
- decInstance2.end(ciphertext)
+ new String(cbcDecrypt(builder)(ciphertext).toArray)
}
}