Bifid cipher: Difference between revisions

m
Line 66:
bifid=: {{ m{~_2 (5&#.)\,|:5 5#:m i.normalize y }}
difib=: {{ m{~5#.|:(|.@$$,)5 5#:m i.normalize y }}</lang>
 
This is pretty much a literal implementation of the algorithm, except that our indices range from 0..4 instead of 1..5 (or, for letter indices, they range from 0..24 instead of 1..25).
 
Much of the implementation is about converting between a two digit base 5 representation and a single digit numeric representation. The rest is simple array manipulations to make the rest come out right.
 
Task examples:<lang J>ref1=: ~.normalize alpha
6,951

edits