Playfair cipher: Difference between revisions

m
Line 1,121:
# Translate key into an encoding 5x5 translation matrix.
keyletters = unique([c for c in canonical(key * "ABCDEFGHIJKLMNOPQRSTUVWXYZ")])
 
m = Char.((reshape(UInt8.(keyletters[1:25]), 5, 5)'))
 
# encod is a dictionary of letter pairs for encoding.
encod = Dict()
 
# Map pairs in same row of matrix m.
for i in 1:5, j in 1:5, k in 1:5
4,108

edits