473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Encrypted passwords

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)

Sep 13 '05 #1
5 2404
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
Sep 13 '05 #2
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.

Sep 13 '05 #3
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

Sep 13 '05 #4
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
Sep 13 '05 #5
bi****@math.com 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

Sep 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: sffan | last post by:
I am new to database programming and was curious how others solve the problem of storing encrypted in data in db table columns and then subsequently searching for these records. The particular...
6
by: Ian Davies | last post by:
Hello I would like to query the user table of the mysql database from my VB application to check that a user's password entered in a text field on a form corresponds to that users password in the...
2
by: DDK | last post by:
I really wish there were some examples explaining how to create a forgot password email link system when you encrypt a password in a database and use ASP.NET/C# preferably. Since the password is...
12
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt...
0
by: Milos Prudek | last post by:
I cannot set up password authentication with encrypted passwords. With plaintext passwords auth works fine. So my guess is that I am using an incorrect password encryption program. What...
26
by: David Garamond | last post by:
I read that the password hash in pg_shadow is salted with username. Is this still the case? If so, since probably 99% of all PostgreSQL has "postgres" as the superuser name, wouldn't it be better...
2
by: Bernard Dhooghe | last post by:
The information center writes: "Encryption Algorithm: The internal encryption algorithm used is RC2 block cipher with padding, the 128-bit secret key is derived from the password using a MD2...
5
by: Shmuel | last post by:
Hello, Is it possible to give to mysql_connect an encrypted (md5 or sha1) password? If not is there a workaround? I store passwords for users in database and don't want to use plain text...
1
by: Brian Stoop | last post by:
Can RDP password be written programatically, is there a dll that contains a method for generating encrypted passwords? thanks
4
n8kindt
by: n8kindt | last post by:
i'm trying to create a secure scenario where no one will be able to know our encrypted database passcode. BUT if they login to a form in another database successfully, it will open the encrypted...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.