Sha256: 65f35003f8e099b8d2bb0aa1522c82b20b019e6b7fec7e4cc6d440ea0652ade7
Contents?: true
Size: 368 Bytes
Versions: 174
Compression:
Stored size: 368 Bytes
Contents
object AtbashCipher { private def substitute(c: Char) = if (c.isDigit) c.toString else if (c.isLetter) ('a' + ('z' - c.toLower)).toChar.toString else "" def encode(s: String): String = s.foldLeft("")((acc, c) => acc + substitute(c)).grouped(5).mkString(" ") def decode(s: String): String = s.foldLeft("")((acc, c) => acc + substitute(c)) }
Version data entries
174 entries across 174 versions & 1 rubygems