Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Encrypted passwords

Reply
Thread Tools

Encrypted passwords

 
 
Salil
Guest
Posts: n/a
 
      09-13-2005
I want to write a program that requires a password to allow the user to
access it. Please suggest a nice & easy to understand (and crack)
algorithm for encryption for the password !
P.S. : I said easy to crack because I want it as a assignment for a
group of First year C++ students.
(The assignment is that the students will have to crack the password)

 
Reply With Quote
 
 
 
 
Jarek
Guest
Posts: n/a
 
      09-13-2005
Salil wrote:
> I want to write a program that requires a password to allow the user to
> access it. Please suggest a nice & easy to understand (and crack)
> algorithm for encryption for the password !
> P.S. : I said easy to crack because I want it as a assignment for a
> group of First year C++ students.
> (The assignment is that the students will have to crack the password)
>

XOR ?

Jarek
 
Reply With Quote
 
 
 
 
binbag@math.com
Guest
Posts: n/a
 
      09-13-2005
XOR does of course beg the question of what you XOR with ?
1st years will of course be tempted to XOR with a constant key, which
means that once you've cracked one password, you've got them all.
Thus you have a layered test, OK students will crack it, smarter ones
will realise the general defect.

Although Jarek gives pretty much the simplest algorithm, if you don't
specify the algorithm than it requires >1st year skill to work out
whether it's XOR, DES, or something that's really secure.

 
Reply With Quote
 
VKV Coders
Guest
Posts: n/a
 
      09-13-2005
Hello , I am a newbie and I found this problem quite interesting.. Can
someone plese tell me what is this XOR algorithm, I want to try it out!
Thanks

 
Reply With Quote
 
Ian Malone
Guest
Posts: n/a
 
      09-13-2005
VKV Coders wrote:
> Hello , I am a newbie and I found this problem quite interesting.. Can
> someone plese tell me what is this XOR algorithm, I want to try it out!
> Thanks
>


^

HTH HAND

--
imalone
 
Reply With Quote
 
Greg
Guest
Posts: n/a
 
      09-13-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> XOR does of course beg the question of what you XOR with ?
> 1st years will of course be tempted to XOR with a constant key, which
> means that once you've cracked one password, you've got them all.
> Thus you have a layered test, OK students will crack it, smarter ones
> will realise the general defect.
>
> Although Jarek gives pretty much the simplest algorithm, if you don't
> specify the algorithm than it requires >1st year skill to work out
> whether it's XOR, DES, or something that's really secure.


There is no more secure encyption algorithm than XOR-ing with a
one-time pad. In fact, it is the only known unbreakable encryption
algorithm.

To keep on topic, I have written below an implementation of the
algorithm in C++ that simply XORs each byte of the plaintext with the
corresponding byte of the secret key:

#include <string>
using std::string;

string
EncryptData( const string& plaintext, const string& key)
{
const int len = key.length();
assert(len >= plaintext.length());

string encryptedText;
int pos = -1;

while (++pos < len)
encryptedText += plaintext[pos] ^ key[pos];

return encryptedText;
}

For most uses, XOR is not practical since it requires that the secret
key be at least as long as the plain text (in order to guarantee that
every possible decryption of an encrypted text is just as likely as any
other). Furthermore each randomly generated key can only be used once,
meaning that both parties must each have the same long list of secret
keys in order to encrypt their messages.

Greg

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing configurations with encrypted passwords pfisterfarm Cisco 2 02-28-2008 01:50 PM
Converting from plain text to encoded/encrypted passwords JF Mezei Cisco 4 05-23-2007 07:14 AM
System Standby on Encrypted Network rexweber@gmail.com Wireless Networking 0 10-21-2005 07:38 PM
Lose encrypted connection after re-boot Joe K Wireless Networking 0 12-27-2004 03:53 AM
Loose encrypted connection after re-boot joekohn@att.net Wireless Networking 0 12-26-2004 03:51 AM



Advertisments