Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Ok, if you've come this far, you must be interested in seeing the code. Here it is:
#--------------------------------------------------------------------- +----# # Crypt::Playwright # Date Written: 21-Mar-2002 04:15:52 PM # Last Modified: 25-Mar-2002 03:06:32 PM # Author: Kurt Kincaid # Copyright (c) 2002, Kurt Kincaid # All Rights Reserved # # NOTICE: This is free software and may be modified and/or redistribut +ed # under the same terms as Perl itself. #--------------------------------------------------------------------- +----# package Crypt::Playwright; use 5.006; use strict; use warnings; use vars qw/ $name $val %Names %Phrases %rNames %rPhrases @Names @Acti +ons @nSpace @pSpace @nA @pA @nE @pE @nN @pN @nO @pO @nR @pR @nS @pS @nT @pT /; require Exporter; our @ISA = qw(Exporter); our $VERSION = '0.02'; %Names = ( 'Edward' => 'A', 'Michael' => 'B', 'Doug' => 'C', 'Bi +ll' => 'D', 'Matt' => 'E', 'Kyle' => 'F', 'Dawn' => 'G', 'Ku +rt' => 'H', 'Courtney' => 'I', 'Amanda' => 'J', 'Taylor' => 'K', 'Sh +elby' => 'L', 'Carol' => 'M', 'Kathy' => 'N', 'Keith' => 'O', 'Ca +rrie' => 'P', 'Corey' => 'Q', 'Kelly' => 'R', 'Erik' => 'S', 'Jo +hn' => 'T', 'Nick' => 'U', 'Eva' => 'V', 'Karen' => 'W', 'Ba +rb' => 'X', 'Ivan' => 'Y', 'Michelle' => 'Z', 'Shelly' => 'a', 'Gu +yla' => 'b', 'Gary' => 'c', 'Dan' => 'd', 'Bianca' => 'e', 'Ha +mlet' => 'f', 'Othello' => 'g', 'Iago' => 'h', 'Brabantio' => 'i', 'Be +renice' => 'j', 'Beatrice' => 'k', 'Emilia' => 'l', 'Amy' => 'm', 'An +gela' => 'n', 'Sheri' => 'o', 'Ginger' => 'p', 'Chloe' => 'q', 'Am +ber' => 'r', 'Kristi' => 's', 'Jasmine' => 't', 'Pierre' => 'u', 'Fr +ancois' => 'v', 'Louis' => 'w', 'Pietro' => 'x', 'Reed' => 'y', 'Pe +ter' => 'z', 'Ned' => '`', 'Homer' => '1', 'Bart' => '2', 'Li +sa' => '3', 'Marge' => '4', 'Margaret' => '5', 'Mo' => '6', 'Ba +rney' => '7', 'Sherlock' => '8', 'Pennywise' => '9', 'Harry' => '0', 'St +ephen' => '-', 'Lenore' => '=', 'Edgar' => '~', 'Howard' => '!', 'Ph +illip' => '@', 'Hrothgar' => '#', 'Gunther' => '$', 'Beowulf' => '%', 'Un +ferth' => '^', 'Arthur' => '&', 'Lancelot' => '*', 'Percival' => '(', 'Bo +rs' => ')', 'Elaine' => '_', 'Igraine' => '+', 'Uther' => ';', 'Me +rlin' => ':', 'Leo' => '"', 'Brett' => "'", 'Shane' => '[', 'Ge +orge' => '{', 'Alfred' => ']', 'Alex' => '}', 'Ron' => '\\','He +nry' => '|', 'Mitchell' => ',', 'Spenser' => '<', 'Ray' => '.', 'Do +nald' => '>', 'Robin' => '/', 'Robert' => '?', 'Kevin' => ' ', 'Te +rry' => ' ', 'Franklin' => ' ', 'Rodney' => ' ', 'Willow' => ' ', 'Bu +ffy' => ' ', 'Brenda' => ' ', 'Mark' => ' ', 'Luke' => ' ', 'El +izabeth' => ' ', 'Tucker' => ' ', 'Hal' => ' ', 'Monica' => 'a', 'Al +len' => 'a', 'Cliff' => 'a', 'Nina' => 'a', 'Palmer' => 'a', 'Jo +seph' => 'a', 'Leslie' => 'a', 'Randall' => 'a', 'Kent' => 'a', 'Gr +onk' => 'a', 'Remick' => 'e', 'Ronald' => 'e', 'Dougal' => 'e', 'An +gus' => 'e', 'Flip' => 'e', 'Jay' => 'e', 'Reese' => 'e', 'Dw +ight' => 'e', 'Rocky' => 'e', 'Bjorn' => 'e', 'Helga' => 'n', 'Lo +ki' => 'n', 'Brunhilda' => 'n', 'Hansel' => 'n', 'Gretel' => 'n', 'Gr +endel' => 'n', 'Bertilak' => 'n', 'Bernie' => 'n', 'Basil' => 'n', 'Er +ol' => 'n', 'Malcom' => 'o', 'Marie' => 'o', 'Jane' => 'o', 'Cl +ark' => 'o', 'Buster' => 'o', 'Franco' => 'o', 'Earl' => 'o', 'La +ertes' => 'o', 'Odysseus' => 'o', 'Telemachus' => 'o', 'Zeus' => 'r', 'He +racles' => 'r', 'Ophelia' => 'r', 'Hera' => 'r', 'Aphrodite' => 'r', 'Ve +nus' => 'r', 'Ares' => 'r', 'Apollo' => 'r', 'Amphitryon' => 'r', 'Ag +amemnon' => 'r', 'Menelaus' => 's', 'Paulo' => 's', 'Ivano' => 's', 'Ju +nior' => 's', 'Jughead' => 's', 'Jared' => 's', 'Jimmy' => 's', 'Pe +rry' => 's', 'Taliesin' => 's', 'Devon' => 's', 'Red' => 't', 'Bo +nzo' => 't', 'Sparky' => 't', 'Tex' => 't', 'Surachai' => 't', 'Sa +maransak' => 't', 'Nai' => 't', 'Jackie' => 't', 'Bruce' => 't', 'Le +nnox' => 't' ); @nSpace = ( 'Kevin', 'Terry', 'Franklin', 'Rodney', 'Willow', + 'Buffy', 'Brenda', 'Mark', 'Luke', 'Elizabeth', 'Tu +cker', 'Hal' ); @nA = ( 'Monica', 'Allen', 'Cliff', 'Nina', 'Palmer', + 'Joseph', 'Leslie', 'Randall', 'Kent', 'Gronk' ); @nE = ( 'Remick', 'Ronald', 'Dougal', 'Angus', 'Flip', + 'Jay', 'Reese', 'Dwight', 'Rocky', 'Bjorn' ); @nN = ( 'Helga', 'Loki', 'Brunhilda', 'Hansel', 'Gretel', + 'Grendel', 'Bertilak', 'Bernie', 'Basil', 'Erol' ); @nO = ( 'Malcom', 'Marie', 'Jane', 'Clark', 'Buster', + 'Franco', 'Earl', 'Laertes', 'Odysseus', 'Telemachus' ); @nR = ( 'Zeus', 'Heracles', 'Ophelia', 'Hera', 'Aphrodite' +, 'Venus', 'Ares', 'Apollo', 'Amphitryon', 'Agamemnon' ); @nS = ( 'Menelaus', 'Paulo', 'Ivano', 'Junior', 'Jughead', + 'Jared', 'Jimmy', 'Perry', 'Taliesin', 'Devon' ); @nT = ( 'Red', 'Bonzo', 'Sparky', 'Tex', 'Surachai', + 'Samaransak', 'Nai', 'Jackie', 'Bruce', 'Lennox' ); %Phrases = ( 'That was funny!' => 'A', ' +How long have you been here?' => 'B', 'How long have you been waiting?' => 'C', ' +When did you say you had your appointment?' => 'D', 'That is a lovely shade of blue.' => 'E', ' +That weighs a bit more than I expected.' => 'F', 'Where did you say you want me to put that?' => 'G', " +I won't put that there." => 'H', "Are you sure I'm supposed to put that there?" => 'I', ' +I need to sharpen my sword.' => 'J', 'I like to paint.' => 'K', ' +Wow, you have a lot of books.' => 'L', 'I finally got my network setup.' => 'M', ' +I need more RAM.' => 'N', 'Where did I put my pen?' => 'O', ' +That looks like a nasty cut.' => 'P', 'Have you got some aspirin?' => 'Q', ' +Got any gum?' => 'R', 'My subscription to Sys Admin is about to expire.' => 'S', " +She's pretty" => 'T', 'I wish it would stop raining.' => 'U', ' +It is waaaaay too hot in here.' => 'V', 'Could you turn that fan off?' => 'W', ' +Do you know much about TCP/IP?' => 'X', 'I finally got my certificate.' => 'Y', ' +That picture frame is a little crooked.' => 'Z', 'Did you hear that noise?' => 'a', ' +Hey, the Inspector General is coming.' => 'b', 'Lucky for me.' => 'c', " +You don't say?" => 'd', 'Could that possibly smell any worse?' => 'e', ' +Probably not.' => 'f', 'How long should I cook this?' => 'g', " +You'll want to cook that very slowly." => 'h', 'Me want beer.' => 'i', ' +I could really use a nap.' => 'j', 'I have to pick up my daughter after work.' => 'k', ' +Do you think anyone will notice?' => 'l', "Not if you expect to go out in public." => 'm', ' +Hey, I like this song.' => 'n', 'That is too expensive for me.' => 'o', ' +Says who?' => 'p', "I don't like it when you touch me there." => 'q', ' +I know, but I never liked it.' => 'r', 'Hot enough for you?' => 's', ' +I had spaghetti for dinner three times last week.' => 't', 'I could have sworn I locked the door.' => 'u', ' +Have you seen my keys?' => 'v', 'I saw it over there.' => 'w', ' +Do these pants make my butt look big?' => 'x', 'Putting on a little weight, I see.' => 'y', " +Say that again and I'll smack you." => 'z', 'I am an excellent driver.' => '`', ' +You drive too fast.' => '1', 'I love pizza.' => '2', ' +Not nearly as much as you do.' => '3', 'Come over here and sit on my lap.' => '4', ' +Not a chance in hell.' => '5', 'You know you want to.' => '6', ' +Sure I do.' => '7', 'You are weak and lack skill.' => '8', ' +How about a nice bottle of wine with dinner?' => '9', 'I could use a shower.' => '0', ' +How many fish did you catch?' => '-', 'That is quite a collection you have there.' => '=', ' +Please stop hitting me with that pickle.' => '~', 'Why would I want to do that?' => '!', ' +I asked nicely.' => '@', 'Look at all those chickens!' => '#', ' +This is taking too long.' => '$', "I've been trying to learn that for ages." => '%', ' +How many times?' => '^', 'Eight or nine, I think.' => '&', ' +Not unless you want me to cry.' => '*', 'I hope she likes it.' => '(', ' +She will, especially if you throw it at her.' => ')', 'He never stops complaining!' => '_', " +Sure, just wait until he isn't looking." => '+', 'Why does that smell like cheese?' => '[', " +I'm not sure I've ever seen anything that ugly." => '{', 'How may of those do you have?' => ']', ' +Lots more than you do.' => '}', 'I would love to.' => '\\',' +I can think of nothing I would like better.' => '|', 'No, it is too soon for that.' => ';', ' +She thinks I dance funny.' => ':', 'Nice socks. Did you get dressed in the dark?' => "'", ' +Why must you say things like that?' => '"', 'Because I think it is funny.' => ',', ' +Hey, you asked.' => '<', "That's the last time I ask for your opinion." => '.', ' +I never did care for that.' => '>', "That's what you think." => '/', ' +Wonderful, my nose is bleeding again.' => '?', 'Why would I do that?' => ' ', ' +I need more paint.' => ' ', 'The water is warm.' => ' ', ' +Have you ever seen so many worms?' => ' ', 'Three, maybe four times. And you?' => ' ', ' +My shoe is untied again.' => ' ', 'I finally got around to doing that.' => ' ', ' +Could you please pass the coleslaw?' => ' ', 'Have you ever seen one of these?' => ' ', " +I've never seen one so close up before." => ' ', 'It looks sort of squashed.' => ' ', ' +Whatever you say.' => ' ', 'Not if you paid me.' => 'a', " +Please don't poke me with that." => 'a', 'Have you looked under the table?' => 'a', ' +It has water in it.' => 'a', 'Hey, nice foot.' => 'a', " +I'm not sure I should put that there." => 'a', 'I beg your pardon?' => 'a', ' +Not at the moment.' => 'a', "I don't think so." => 'a', ' +Who?' => 'a', 'I never did learn how to do that very well.' => 'e', ' +It is much heavier than it looks.' => 'e', 'No, you have too many already.' => 'e', ' +Done!', => 'e', 'I win, you lose.' => 'e', ' +Get bent.' => 'e', 'When would be a good time for you?' => 'e', ' +Pfah!' => 'e', 'In your shoe, I think.' => 'e', ' +I did that yesterday.' => 'e', 'Ok, but it will cost you.' => 'n', ' +I like it when you touch me there.' => 'n', 'Have I ever told you that you look like Ted Koppel?' => 'n', " +Shhhh. I'm trying to listen to this." => 'n', 'Will you never stop crying?' => 'n', ' +Because I said so.' => 'n', 'As soon as the train stops.' => 'n', ' +That is a very large apple.' => 'n', "I'm not sure what that is." => 'n', ' +No thanks.' => 'n', 'Could you repeat that?' => 'o', ' +I have never been so bored.' => 'o', 'So what are your thoughts on Tolstoy?' => 'o', " +I'm still trying to find the plot." => 'o', "He's rather fond of himself, isn't he?" => 'o', " +Well it looks like...I don't know what it looks like." => 'o', 'Your point being?' => 'o', ' +And...?' => 'o', 'I have a picture of that on my mousepad.' => 'o', ' +That stain will never come out.' => 'o', 'I tried that once, but it felt really weird.' => 'r', ' +That door sure is hard to open.' => 'r', 'That really hurt.' => 'r', ' +I have to delete that.' => 'r', 'It is just too big.' => 'r', ' +Only when I cross my eyes.' => 'r', 'Do you really think so?' => 'r', ' +I took an educated guess.' => 'r', 'Your theory is fundamentally flawed.' => 'r', " +You probably shouldn't put your finger there." => 'r', 'I think you broke it.' => 's', ' +It just needs new batteries.' => 's', 'How long have you known?' => 's', " +You think I'm dumb, don't you?" => 's', "I've never been so insulted." => 's', ' +Sure is windy out there.' => 's', 'I wish I could fly.' => 's', ' +At night the ice weasles come.' => 's', 'The penguins are tearing at my flesh.' => 's', ' +Do you smell smoke?' => 's', 'You should try it sometime.' => 't', " +I don't think I'd like that." => 't', 'Kiss me.' => 't', ' +Do you need a tissue?' => 't', 'Good question.' => 't', ' +What an ugly cat!' => 't', 'Want to hear a joke?' => 't', ' +Not if you are the one doing it.' => 't', 'It sure is a long way down.' => 't', ' +How long did it take to make that?' => 't' ); @pSpace = ( 'Why would I do that?', 'I need more paint.', + 'The water is warm.', 'Have you ever seen so many worms?', 'Three, maybe four time +s. And you?', 'My shoe is untied again.', 'I finally got around to doing that.', 'Could you please pass +the coleslaw?', 'Have you ever seen one of these?', "I've never seen one so close up before.", 'It looks sort of squas +hed.', 'Whatever you say.' ); @pA = ( 'Not if you paid me.', "Please don't poke me with tha +t.", 'Have you looked under the table?', 'It has water in it.', 'Hey, nice foot.', "I'm not sure I should put tha +t there.", 'I beg your pardon?', 'Not at the moment.', "I don't think so.", 'Who?' ); @pE = ( "I never did learn how to do that very well.", "It is much heavier + than it looks.", "No, you have too many already.", "Done!", "I win, you lose.", "Get bent.", "When would be a good time for you?", "Pfah!", "In your shoe, I think.", "I did that yesterd +ay." ); @pN = ( 'Ok, but it will cost you.', 'I like it +when you touch me there.', 'Have I ever told you that you look like Ted Koppel?', "Shhhh. I'm + trying to listen to this.", 'Will you never stop crying?', 'Because I +said so.', 'As soon as the train stops.', 'That is a +very large apple.', "I'm not sure what that is.", 'No thanks. +' ); @pO = ( 'Could you repeat that?', 'I have never been so +bored.', 'So what are your thoughts on Tolstoy?', "I'm still trying to f +ind the plot.", "He's rather fond of himself, isn't he?", "Well it looks like... +I don't know what it looks like.", "Your point being?", 'And...?', 'I have a picture of that on my mousepad.', 'That stain will never + come out.' ); @pR = ( 'I tried it once, but it felt really weird.', 'That door sure is h +ard to open.', 'That really hurt.', 'I have to delete th +at.', 'It is just too big.', 'Only when I cross m +y eyes.', 'Do you really think so?', 'I took an educated +guess.', 'Your theory is fundamentally flawed.', "You probably should +n't put your finger there." ); @pS = ( 'I think you broke it.', 'It just needs new batteries.', 'How long have you known?', 'I wish I could fly.', 'At night the ice weasles come.', 'The penguins are tearing at my +flesh.', "You think I'm dumb, don't you?", "I've never been so insulted.", 'Sure is windy out there.', 'Do you smell smoke?' ); @pT = ( 'You should try it sometime.', "I don't think I'd like that.", 'Kiss me.', 'Do you need a tissue?', 'Good question.', 'What an ugly cat!', 'Want to hear a joke?', 'Not if you are the one doing it.', 'It sure is a long way down.', 'How long did it take to make that? +' ); while ( ( $name, $val ) = each %Names ) { $rNames{ $val } = $name; } while ( ( $name, $val ) = each %Phrases ) { $rPhrases{ $val } = $name; } @Names = keys %Names; @Actions = ( 'writes a poem', 'enters from stage lef +t', "peers over Michael's shoulder", 'laughs', 'screams in pain', 'opens a book', 'sits at the table', 'crosses stage right', 'looks under the chair', 'straightens the table + cloth', 'opens the window', 'looks around in confu +sion', 'starts singing quietly', 'closes the window', 'cries', 'enters from stage rig +ht', 'crosses stage left', 'picks up the book', 'breaks the mirror', 'kicks the table', 'gazes longingly at Pietro', 'dances a merry jig', 'thinks happy thoughts', 'falls to the floor', 'tries to think of something funny to say', 'yearns for the good o +ld days', 'turns on the radio', 'turns off the radio', 'turns on the television', 'turns off the televis +ion', 'selects a book from the bookshelf', 'concentrates', 'burps', 'clucks like a chicken +', 'motions toward the door', 'plops down on the sof +a', 'looks around suspiciously', 'beings folding laundr +y', 'takes a pan of brownies from the oven', 'thinks of the color b +lue', "pours vinegar in Karen's shoes", 'eats a pickle', 'disrobes', 'dances about like a l +oon', 'flits about like a fawn in springtime', 'does an impression of + Charlie Chaplin', 'takes a ham from the oven', 'begins plucking a chi +cken', 'tries to hide under the rug', 'removes the cushions +from the sofa', 'opens the pantry', 'climbs in the pantry' +, 'crawls under the sink', 'closes the pantry', 'fixes a turkey sandwich', 'starts making pancake +s' ); my $nullPhrase = "I don't feel so good."; sub RandomElement { my $arrayref = shift; $arrayref->[ rand @{ $arrayref } ]; } sub StageDirections { return "[ " . RandomElement( \@Names ) . " " . RandomElement( \@Ac +tions ) . ". ]\n"; } sub Make { my $string = shift; my @chars = split ( //, $string ); my ( $out, $i, $temp ); for ( $i = 0 ; $i <= $#chars ; $i += 2 ) { if ( $chars[ $i ] eq "\n" ) { $out .= StageDirections(); $i--; next; } elsif ( $chars[ $i ] eq " " ) { $temp = RandomElement( \@nSpace ) . ":"; } elsif ( $chars[ $i ] eq "a" ) { $temp = RandomElement( \@nA ) . ":"; } elsif ( $chars[ $i ] eq "e" ) { $temp = RandomElement( \@nE ) . ":"; } elsif ( $chars[ $i ] eq "n" ) { $temp = RandomElement( \@nN ) . ":"; } elsif ( $chars[ $i ] eq "o" ) { $temp = RandomElement( \@nO ) . ":"; } elsif ( $chars[ $i ] eq "r" ) { $temp = RandomElement( \@nR ) . ":"; } elsif ( $chars[ $i ] eq "s" ) { $temp = RandomElement( \@nS ) . ":"; } elsif ( $chars[ $i ] eq "t" ) { $temp = RandomElement( \@nT ) . ":"; } else { $temp = "$rNames{ $chars[ $i ] }:"; } if ( $chars[ $i + 1 ] eq "\n" || $chars[ $i + 1 ] eq "" ) { $out .= $temp . " " . RandomElement( \@pSpace ) . "\n" . S +tageDirections(); next; } elsif ( $chars[ $i + 1 ] eq " " ) { $temp .= " " . RandomElement( \@pSpace ); } elsif ( $chars[ $i + 1 ] eq "a" ) { $temp .= " " . RandomElement( \@pA ); } elsif ( $chars[ $i + 1 ] eq "e" ) { $temp .= " " . RandomElement( \@pE ); } elsif ( $chars[ $i + 1 ] eq "n" ) { $temp .= " " . RandomElement( \@pN ); } elsif ( $chars[ $i + 1 ] eq "o" ) { $temp .= " " . RandomElement( \@pO ); } elsif ( $chars[ $i + 1 ] eq "r" ) { $temp .= " " . RandomElement( \@pR ); } elsif ( $chars[ $i + 1 ] eq "s" ) { $temp .= " " . RandomElement( \@pS ); } elsif ( $chars[ $i + 1 ] eq "t" ) { $temp .= " " . RandomElement( \@pT ); } else { $temp .= " " . $rPhrases{ $chars[ $i + 1 ] }; } $out .= $temp . "\n"; } return $out; } sub UnMake { my $string = shift; my $out = ""; my @lines = split ( /\n/, $string ); foreach my $line ( @lines ) { ( $name, $val ) = split ( /: /, $line ); if ( $name =~ /^\[/ && ! $val ) { $out .= "\n"; next; } if ( defined $Names{ $name } ) { $out .= $Names{ $name }; } if ( defined $Phrases{ $val } ) { $out .= $Phrases{ $val }; } } return $out; } 1; __END__ =head1 NAME Crypt::Playwright - Simple text obfuscation in the form of a play. =head1 SYNOPSIS use Crypt::Playwright; $play = Crypt::Playwright::Make( $string ); $plaintext = Crypt::Playwright::UnMake( $play ); =head1 DESCRIPTION To be honest, I did this mostly for the comedy value. I was toying wit +h the idea of making a real steganography module, and the next thing +I knew, I was writing Playwright. It does offer a degree of security, + especially if you replace some of the default names and/or phrases w +ith your own. =head1 AUTHOR Kurt Kincaid <sifukurt@yahoo.com> =head1 SEE ALSO L<perl>. =cut
Please post replies to the parent node.

Thanks for your time and input.
___________________
Kurt

In reply to Re: Requesting feedback by sifukurt
in thread Requesting feedback by sifukurt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-03-28 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found