Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Mystery Novelist seeks ELS generator

by dimar (Curate)
on Nov 17, 2004 at 20:01 UTC ( #408556=perlquestion: print w/ replies, xml ) Need Help??
dimar has asked for the wisdom of the Perl Monks concerning the following question:

You probably have heard of the phenomenon known as "Equidistant Letter Sequences" and the controversy surrounding them. If you haven't, your favorite search engine will give you an introduction.

For purposes of this question, issues regarding the nature, validity, philosophical implications et al ... of this phenomenon are *irrelevant* ... please disregard all that stuff.

The question here is simple: does anyone know a way to *intentionally generate* the "ELS" phenomenon using an existing corpus of English language text? Perhaps if you do not like the term "ELS" you could also call it 'stenography' ... the main goal is to 'embed' a 'cyphertext' message inside a 'plaintext' message in such a way that the cyphertext is plainly and obviously apparent once the novelist reveals the 'decoder letter-distance sequence' to the reader. Moreover, the 'plaintext' should not look 'garbled' or artificial after it is run through the ELS generator.

This may be a complete pipe dream, but it couldn't hurt to ask if anyone has done any work in this area, that they are willing and able to share, or at least give some suggestions, citations, whatever ... (obviously perl is the preferred tool)

TIA.

Comment on Mystery Novelist seeks ELS generator
Re: Mystery Novelist seeks ELS generator
by dragonchild (Archbishop) on Nov 17, 2004 at 20:04 UTC
    It shouldn't be difficult, if you reverse the problem. Instead of approaching it from the "I have XYZ text to be hidden and I want to use a distance of NNN, how do I create a text?", why not approach it from the "I have XYZ text to be hidden and here is a corpus for me to try and hide it in, where should I start and what should my distance be?"

    In other words, start with your message and your corpus and then have a program that figures out where in the corpus you should start and what your distance will be.

    The rest, imho, is a first-year programming exercise.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re: Mystery Novelist seeks ELS generator
by tall_man (Parson) on Nov 17, 2004 at 20:21 UTC
    You mean "steganography" (writing messages concealed in other messages) and not "stenography" (writing shorthand). Here is a site with examples of steganography.

    It would be easy, with the help of a file like /usr/dict/words, to write a perl program to create a list of words that encoded whatever message you wanted. But to make the list look like meaningful, grammatical text -- that's very doubtful.

Re: Mystery Novelist seeks ELS generator
by nimdokk (Vicar) on Nov 17, 2004 at 20:37 UTC
    This sounds like what Arthur Conan Doyle did in 'The "Gloria Scott."'
Re: Mystery Novelist seeks ELS generator
by jZed (Prior) on Nov 17, 2004 at 20:47 UTC
    Here's a perl/ELS link.

    My favorite (found on the web,not from that code) has got to be "Thou hast done foolishly in so doing" ... start at letter 4 and skip 12 characters twice ... Roswell, predicted in the bible!

      Yeah, and the amazing part is whoever wrote the bible anticipated this English translation over a thousand years before English existed! :)
Re: Mystery Novelist seeks ELS generator
by TedPride (Priest) on Nov 18, 2004 at 09:29 UTC
    You just need a large input of text that can be incremented through from 2 characters at a time to length / message length characters at a time. If your message isn't horribly long, chances are it can be hidden - and if not, you can always rewrite your message and try again. A list of synonyms for each word in your message is good for this - just try all possible message combinations with all possible spacings and see which ones can be hidden. For instance:
    use strict; $_ = 'America'; $_ = lc($_); s/[^a-z]//g; my @m = split(//); open(INP, 'pkjv.txt'); read(INP, $_, 3500000); close(INP); my ($n, $find); for $n (2..100) { $find = join(".{$n}", @m); if (m/($find)/g) { print pos() . " $n $1"; exit; } }
    Returns:
    1277399 23 alsohosahofthechildrenofmerarihadsonssimrithechiefforthough +hewasnotthefirstbornyethisfathermadehimthechiefchhilkiahthesecondteba +liahthethirdzecha
    (I'd already processed the KJV file to remove all characters other than a-zA-Z and lc. This example does not include synonyms)
Re: Mystery Novelist seeks ELS generator
by tall_man (Parson) on Nov 18, 2004 at 16:32 UTC
    Here is another script that will search for a given sequence at a given spacing. It can be applied to any text, without requiring it to be stripped first. The assumption here is that spacing and punctuation will be ignored.
    #!/usr/bin/perl use strict; use warnings; my ($message, $spacing); if ($#ARGV >= 1) { $message = shift; $spacing = shift; } else { die "Usage: els_find.pl message spacing files\n"; } $spacing > 0 or die "Spacing must be greater than zero\n"; # Build a pattern that will recognize the message in regular # text, ignoring punctuation and spacing. my @letters = split //,$message; my $pattern = join("(?:[^a-z]*[a-z]){$spacing}",@letters); my $re = qr/($pattern)/i; # Allow minimal wrapping across lines without having to slurp # the whole file. $/ = ''; # paragraph mode while (<>) { chomp; if ($_ =~ $re) { print "Matched: *$1* at paragraph $. of file $ARGV\n"; } }
Re: Mystery Novelist seeks ELS generator
by TrekNoid (Pilgrim) on Nov 18, 2004 at 17:10 UTC
    One wrinkle in ELS that can make a volume of text more likely to contain a word is that it *doesn't* have to be letters at exactly equidistant spaces.

    It's also valid ELS to wrap text into rectangular blocks and then search diagonally, horizontally and vertically... This is called the 'ELS matrix-slide' approach, and it's how people find more than one word in a short section of text

    Trek

Re: Mystery Novelist seeks ELS generator
by jZed (Prior) on Nov 18, 2004 at 18:22 UTC
    Ok, couldn't resist. Here's three of everyone's favorite three-letter perl modules in ELS:
      Databases can be easily got with perl codes.
      Lets you access web to retrieve piles of files.
      Can always be good to help with HTML pages.
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://408556]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-12-18 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls