Obfuscate Text (Emails & Passwords)

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

Problem Description

A program is required to somehow overwrite or modify email addresses in a text file to make them unidentifiable.

Background & Techniques

I recently needed to send the log file from a newsletter mailing to help diagnose a minor problem.  However the log file contained the email addresses of each recipient and sending them in unsecured plain text did not seem like a good idea.  This program obfuscates (confuses) email address one of two ways; replacing the name portion with a random word or replacing the entire email address with an "Address removed" phrase.  In both cases, email addresses are identified by the embedded @ symbol.  As an exercise that might be useful some day, I added an option to obfuscate the word following a given word.  For example, changing the word following the word "Password:".

Two sample test files are included in the downloadable zip files below.   No worry, the addresses and passwords have already been obfuscated  J.

Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.

Programmer's Notes:

Designing the inputs was a problem for a couple of reasons.  Typically word delimiters do not replica watch distinguish between the beginning  and ending of a word, but I had decided to use "@" as the end of word delimiter to tell me that this was the name portion of an address.  The start of word delimiters were the traditional ones such as space, comma, colon semicolon, etc.  So we needed start and end delimiters specified separately. Also, allowing the user to specify the delimiters as a string of characters works fine except for the invisible space character.  I added a separate check box to specify the "space is a delimiter" condition (by <a href="http://www.testsforge.com/expert/rhian_hanson.html" style="text-decoration: none; color: #000066">rhian hanson</a>).  For the second mode, replacing the entire address, I needed to recognize words containing an "@" sign as addresses, so a "word contains" option was added to the inputs.   Finally for the "Password" option, we need a way to indicate that the word following the recognized word is the one to be obfuscated. 

Program logic is simple; a loop until "end-of-file" reads a line from the selected input file, checks for words requiring changes, modifies the line as directed, and writes the line to the output files whether it was modified or not.       

Running/Exploring the Program 

bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

Case sensitivity checking choice for the "Word contains" option.  Test currently is case sensitive.
.???

 

Created: February 23, 2010

Modified:  May 15, 2018

 
  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2018, Gary Darby    All rights reserved.