The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to unzip multiple files (encrypted) in a directory. er_ashu UNIX for Dummies Questions & Answers 2 07-03-2007 06:16 PM
Compare files Berserk Shell Programming and Scripting 6 09-05-2005 05:04 AM
encrypted files w33man UNIX for Dummies Questions & Answers 3 03-02-2004 12:06 PM
executing encrypted files Kawah Cheung UNIX for Advanced & Expert Users 4 03-10-2002 10:36 AM
executing encrypted files Kawah Cheung UNIX for Dummies Questions & Answers 1 03-05-2002 05:17 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-14-2009
nsharath's Avatar
nsharath nsharath is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 79
Smile how to compare 2 encrypted files?

I have 2 files :-
1) f1.txt and f2.txt.Both contain some text as -
Quote:
123456

2)Now I did :
Quote:
[...]#cmp f1.txt f2.txt
(OR)
[...]#diff f1.txt f2.txt
output: I got them to be equal.
3) I encrypted them using gpg and with the SAME paraphrase :-
Quote:
gpg -c --cipher-algo aes256 f1.txt

gpg -c --cipher-algo aes256 f2.txt
4)Now I did :
[...]#cmp f1.txt.gpg f2.txt.gpg
(OR)
[...]#diff f1.txt.gpg f2.txt.gpg
[/QUOTE]
output: I got them to be NOT equal.

Can you please tell me why?
My actual intension is to know how to compare any 2 encrypted files to know whether they contain the same text or not without DECRYPTING them!!!!
  #2 (permalink)  
Old 03-14-2009
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
That is a feature, not a bug. With many algorithms the data is encrypted block by block. And the previous encrypted data block is combined with the current plaintext data block as part of the encryption. To get the ball rolling, the algorithm generates a block a random data to combine with the first plain text data block. During decryption, this initial block of make believe encrypted data is discarded.

Now if the same data is encrypted with the same pass phrase, you can't tell by looking at the data. This is a good thing.

The only way to compare two encrypted data files is to decrypt them. If you don't know both passphrases, the contents of the files are none of your business.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0