Guest User

Untitled

a guest
Apr 14th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.45 KB | None | 0 0
  1.  trait Text {
  2.     val text:List[Int]
  3.     override def toString: String
  4.  
  5.     def xor(other:Text) = {
  6.       val xorText = (text zip other.text) map { case (a,b) => a^b }
  7.     }
  8.   }
  9.  
  10.   class PlainText(val text:List[Int]) extends Text       {
  11.     override def toString: String = text.map(_.toChar).mkString(" ")
  12.   }
  13.  
  14.   class CypherText(val text:List[Int]) extends Text       {
  15.     override def toString: String = text.map("%x".format(_)).mkString(" ")
  16.   }
Advertisement
Add Comment
Please, Sign In to add comment