Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

In my quest recently to find a way of encrypting and decrypting a string in perl. I came accross this GEM of a web site Infrequently Asked Questions About Perl

I was searching for "perl string decrypt" and came across this page that has this

How do I decrypt a string that I encrypted with crypt()?

I thought I had struck gold. This is exactly what I had been looking for, for hours.

I looked at the code in his solution and thought ... jeesh I am going to need to concentrate on this.!..
This is what it looked like.

sub decrypt { my $c = shift; my @c = (0) x 8; for (;;) { my $i = 0; my $s = join '', map chr, @c; return $s if crypt($s, $c) eq $c; $c[$i]=0, $i++ while $c[$i] == 255; return undef if $i > 7; $c[$i]++; } }

A Warning even followed.

Warning: Exporting this function outside the USA may be illegal under the provisions of ITAR.

I loaded the code into my editor and as I was about to start I noticed the question below the one I was interested in,

How do I get my perl program to run faster?

use more 'cpu'; use less 'time'; use more 'speed';

No!!! It can't be... I have never seen those used before...

It was only then that I started to read the page from the begining...

My best is...

How do I get tomorrow's date?

Use this function:
sub tomorrow_date { sleep 86_400; return localtime(); }

There must be tons more of this stuff out there, as soon as I get a gap I am going to search for it.
Of all the things I've lost in my life, its my mind I miss the most.

In reply to Perl Humor by AcidHawk

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (5)
    As of 2021-02-24 21:28 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found