Property definitions

crypto $ SingleByteXorCipher :: defaultinit
# Simple XOR cipher where the whole plaintext is XORed with a single byte.
class SingleByteXorCipher
	super Cipher

	# Cryptographic key used in encryption and decryption.
	var key: Int = 0

	redef fun encrypt do
		var key_bytes = new Bytes.with_capacity(1)
		key_bytes.add(key)
		ciphertext = plaintext.xorcipher(key_bytes)
	end

	redef fun decrypt do
		var key_bytes = new Bytes.with_capacity(1)
		key_bytes.add(key)
		plaintext = ciphertext.xorcipher(key_bytes)
	end
end
lib/crypto/xor_ciphers.nit:67,1--85,3