summaryrefslogtreecommitdiff
path: root/src/solvers
diff options
context:
space:
mode:
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)
}
}