Atbash is a symmetric substitution cypher that relies on the symmetry of the Hebrew alphabet. It substitutes each letter with it's symmetrically opposed letter from the middle of the alphabet. It can also be applied to a Latin alphabet by taking the letter as the pivot.
Given a plain-text letter and its index in the alphabet , in order to obtain the cypher letter we subtract its position in the alphabet from the size of the alphabet .
In order to obtain the plaintext, we perform the same operation.