fix: use int as unsigned short correctly in encipher and decipher