package ixee.cryptopals.solvers import scala.io.Source import ixee.cryptopals.utils.ByteUtils._ import ixee.cryptopals.utils.ConversionUtils._ import ixee.cryptopals.utils.FunctionUtils._ import ixee.cryptopals.utils._ import io.github.marklister.base64.Base64._ import javax.crypto.Cipher import javax.crypto.spec.SecretKeySpec object Challenge7 { val path = "./data/7.txt" lazy val ciphertext = Source .fromFile(path) .getLines() .toSeq .flatten .mkString .toByteArray val key = new SecretKeySpec( "YELLOW SUBMARINE".asBytes.toArray, "AES" ) def run = { val cipher = Cipher.getInstance( "AES/ECB/PKCS5Padding" ) cipher.init(Cipher.DECRYPT_MODE, key) new String(cipher.doFinal(ciphertext)) } }