Vernam algorithm implementation