Re: simple cipher
- To: mathgroup at smc.vnet.net
- Subject: [mg55396] Re: simple cipher
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Mon, 21 Mar 2005 03:02:03 -0500 (EST)
- Organization: The University of Western Australia
- References: <d1jfms$s8q$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <d1jfms$s8q$1 at smc.vnet.net>, zak <chocolatez at gmail.com> 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, StringJoin @ Select[s1 (ToString /@ s2), # != 0 & ] > i have the following approach, i hope there is other > versions. > > p = Flatten[Position[s1, 1]] > out[]= {1, 3, 6, 8} > > str = ""; > Do[str = StringJoin[str, ToString[s2[[p[[i]]]]]], {i, 1, 4}] > str > > Out[]= Love Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul