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

RFC: SecureString - Obfuscated / masked strings exept when you need them

by duelafn (Parson)
on Jul 19, 2011 at 14:48 UTC ( [id://915483]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      my $ccn = Text::Hidden->new( "1234567887654321" );
    
      say STDERR "DEBUG: Got a CCN ($ccn)";        # DEBUG: Got a CCN (XXX
    +XXXXXXXXXXXXX)
    
      say "The real CCN: ", $ccn->unhidden_value;  # The real CCN: 1234567
    +887654321
    
  2. or download this
      my $ccn = Text::Hidden->new( "1234567887654321",
          obfuscator => sub { "XXXXXXXXXXXX".substr($_[0], -4) },
      );
    
  3. or download this
      my $passwd = Text::Hidden->new( "12345",
          auto_unhide => [
    ...
          # similar, but search call stack (not just immediate caller) for
    + a match
          auto_unhide_recursive => [ ... ],
      );
    
  4. or download this
      my $passwd = Text::Hidden->new( "12345",
          debug => 1,
          trace => 0, # set to 1 to show entire call stack
      );
    
  5. or download this
      say $passwd;
      say $passwd->unhidden_value;
      Some::Module->login( $user, $passwd );
    
  6. or download this
      Stringification to hidden value at main::(5)
      Explicit cast to unhidden value at main::(6)
      Stringification to hidden value at Some::Module::Authentication::log
    +ger(14)
      Stringification to hidden value at Some::Module::Authentication::aut
    +henticate(43)
    
  7. or download this
      my $ccn = Text::Hidden->new( "1234567887654321",
          default => "unhidden",
          hide_from_recursive => [ qr/^DB[ID]/ ],
      );
    
  8. or download this
      { my $key = $ccn->localized_default_unhidden;
    
    ...
      { my $key = $ccn->localized_default_hidden;
        # ...
      }
    
  9. or download this
      $SIG{__DIE__} = sub {
          local $Text::Hidden::Force = "hidden";
          # ...
      };
    
  10. or download this
    package SecureString;
    use 5.010;
    ...
    SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPER
    +ATE
    WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://915483]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found