Performs a Rotation of x on each letter of self

Works by replacing every character in self by its rotated char.

Say we have a rotation of 3 (Caesar rotation, for culture) for a string : "aybabtu"

a, rotated by 3 becomes d y, rotated by 3 becomes b b, rotated by 3 becomes e t, rotated by 3 becomes w u, rotated by 3 becomes x

We then replace every letter in our original string by their rotated representations, therefore yielding : "dbedewx"

assert "All your base are belong to us".rot(13) == "Nyy lbhe onfr ner orybat gb hf"
assert "This is no moon.".rot(4).rot(22) == "This is no moon."

NOTE : Works on letters only NOTE : This cipher is symmetrically decrypted with an x of 26-x

Property definitions

crypto :: basic_ciphers $ Text :: rot
	# Performs a Rotation of `x` on each letter of self
	#
	# Works by replacing every character in `self` by its
	# rotated char.
	#
	# Say we have a rotation of `3` (Caesar rotation, for
	# culture) for a string : "aybabtu"
	#
	# a, rotated by 3 becomes d
	# y, rotated by 3 becomes b
	# b, rotated by 3 becomes e
	# t, rotated by 3 becomes w
	# u, rotated by 3 becomes x
	#
	# We then replace every letter in our original string by
	# their rotated representations, therefore yielding : "dbedewx"
	#
	#     assert "All your base are belong to us".rot(13) == "Nyy lbhe onfr ner orybat gb hf"
	#     assert "This is no moon.".rot(4).rot(22) == "This is no moon."
	#
	# NOTE : Works on letters only
	# NOTE : This cipher is symmetrically decrypted with an `x` of 26-`x`
	fun rot(x: Int): Text do
		var rot = x % 26
		if rot < 0 then rot += 26
		var d = new FlatBuffer.with_capacity(length)
		for i in chars do
			d.add i.rot(rot)
		end
		return d.to_s
	end
lib/crypto/basic_ciphers.nit:46,2--76,4