From 8a0354348d1f022908eaeecc162ea4aeb24ba910 Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 21 Nov 2014 23:04:39 -0800 Subject: tests 'n stuff --- test/Set1Spec.scala | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/Set1Spec.scala (limited to 'test') diff --git a/test/Set1Spec.scala b/test/Set1Spec.scala new file mode 100644 index 0000000..4dbbfef --- /dev/null +++ b/test/Set1Spec.scala @@ -0,0 +1,35 @@ +package ixee.cryptopals.test + +import com.ixee.IxeeSpec + +class Set1Spec extends IxeeSpec { + + import ixee.cryptopals.utils.ConversionUtils._ + + "Set1" - { + + "Challenge 1: converts from a hex string to base64" in { + + hexStr2Base64String( + "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d" + ) mustBe( + "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t" + ) + } + + "Challenge 2: xor's two equal-length buffers" in { + + val a = hexStr2Bytes( + "1c0111001f010100061a024b53535009181c" + ) + val b = hexStr2Bytes( + "686974207468652062756c6c277320657965" + ) + + (a xor b).toHexStr mustBe + "746865206b696420646f6e277420706c6179" + } + + } + +} -- cgit v1.1