Vigenère cipher

I think this version is really clear. I was doing something along these lines to post but yours is better. One thing to note is that if you do a Vigenère cipher with bytes, then the whole dance goes away and you get what looks like junk for your cypher text, which could be good or bad depending on your preferences.

encrypt(message::String, codeword::String, + = +) =
    String([a + b for (a, b) in zip(
        codeunits(message),
        Iterators.cycle(codeunits(codeword))
    )])

decrypt(message::String, codeword::String) =
    encrypt(message, codeword, -)
julia> c = encrypt("This is a message", "code")
"\xb7\xd7\xcd\u603\xd8ׅď\xd1\xca\xd6\xe2\xc5\xcc\xc8"

julia> decrypt(c, "code")
"This is a message"
5 Likes