MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simple cipher

  • To: mathgroup at
  • Subject: [mg55400] Re: Simple cipher
  • From: Hui Fang <fangh73 at>
  • Date: Mon, 21 Mar 2005 03:02:06 -0500 (EST)
  • Organization: Xiamen University Photonics Center
  • References: <>
  • Reply-to: fangh73 at
  • Sender: owner-wri-mathgroup at

Well, I believe there are a lot of ways to achieve this goal. Here is my 

Assume s1 and s2 have the same length, and s1 contains 1 and 0 only. 
Then the product of s1 and s2 will delete all the letters in s2 except 
the letters you ciphered.

Out[]= {L,0,o,0,0,v,0,e}

(* And then we just extract those letters of the word. *)
Out[]= {L,o,v,e}

(* And finally we get the string *)
Out[]= Love


zak wrote:

>s1 = {1, 0, 1, 0, 0, 1, 0, 1}
>s2 = {L, r, o, w, e, v, y, e}
>s1 is a kind of a sieve i want to look through to s2, so i could pick
>every letter in s2 wich correspond to every digit=1 in s1 so i could
>obtain the word "love", this is like the trivial ciphers we know in
>our childhood, i have the following approach, i hope there is other
>p = Flatten[Position[s1, 1]]
>out[]= {1, 3, 6, 8}
>str = "";
>Do[str = StringJoin[str, ToString[s2[[p[[i]]]]]], {i, 1, 4}]
>Out[]= Love

  • Prev by Date: Re: simple cipher
  • Next by Date: Re: simple cipher
  • Previous by thread: Re: simple cipher
  • Next by thread: Re: simple cipher