Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Reversible per-line "encryption"

by xtype (Deacon)
on Jan 26, 2002 at 00:46 UTC ( #141639=note: print w/replies, xml ) Need Help??

in reply to Reversible per-line "encryption"

Hrmmmm… Seems to me that it should be the datacenter who is encrypting the file and then providing you with the means to decrypt ONLY what you should see. Right?
In which case the other answers are good.
However, since you have to trust them to be able to run and install whatever you hand them, better keep it real simple. The following might be really lame but at least it will run on most versions of perl without any effort. After all, you did say "we must not be able to easily (plain-text) read any records which do not belong to us."
Depends on what you consider to be "easy" and "plain-text" I guess.

To encrypt and decrypt strings in an super low-security fashion:
#!/usr/bin/perl -w use strict; ## their side before sending the file to you... my $line = "ABC|John Smith 1234"; my ($groupID, $text) = split(/\|/, $line, 2); $text =~ tr/a-z/f-za-e/; $text =~ tr/A-Z/I-ZA-H/; $text =~ tr/0-9/4-90-3/; $line = $groupID . "\|" . $text; print "$line\n"; ## And then on your end... my $myGroup = "ABC"; my ($group, $data) = split(/\|/, $line, 2); if($group eq $myGroup) { $data =~ tr/f-za-e/a-z/; $data =~ tr/I-ZA-H/A-Z/; $data =~ tr/4-90-3/0-9/; } print "$data\n";
Of course you/they would have to create different translations for each different group (perhaps trade digits with chars and uc with lc, etc.), and then provide the reverse translation to that group.

No, do not laugh… I know, I know, if someone really wanted to... They would just sit down and stare at the file for a few minutes.
Therefore, I am making the assumption that if "the datacenter" really cared they would come up with something better.


Replies are listed 'Best First'.
Re: Re: Reversible per-line "encryption"
by bmcatt (Friar) on Jan 26, 2002 at 01:04 UTC
    Yeah, this is probably something along the lines of what we'll need to do.

    Unfortunately, it's not a question of "the datacenter". Rather, it's a separate company that's providing data to us (and then we will have sub-contracts with other companies to do some of the servicing, but not all). We need to be able to demonstrate (should anyone ever ask) that the data we're providing to our subs is not plain-text readable by anyone here.

    We don't have to say that we couldn't read it if we wanted to. We just say that we've got a Standard Operating Procedure (SOP) that says that we don't decrypt data which isn't for us. Hence, we're not particularly concerned with "stare-ability" - just the ciphering.

    Btw, that was why I had the (subtle) invitation to golf a ciphering/deciphering algorithm which allowed for different "salts".

      Non the less, you would think it up to the person providing the data.

      Btw, that was why I had the (subtle) invitation to golf a ciphering/deciphering algorithm which allowed for different "salts".

      Never used golf before… but something else that might work is to use the Xor operator. If you Xor something twice you get the original value.
      my $passphrase = "I love group ABC"; … $text ^= $passphrase; $line = $groupID . "\|" . $text; print "$line\n"; … if($group eq $myGroup) { $data ^= $passphrase; } print "$data\n";
      Read that in a Steven Holznar book ...I think.
      update: Although that may be less obscure than my first idea.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://141639]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-05-24 15:29 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (84 votes). Check out past polls.