Article View: comp.os.ms-windows.programmer.tools
Article #931Re: Password encryption/de-cryption
From: Alistair Priest
Date: Wed, 09 Aug 1995 08:46
Date: Wed, 09 Aug 1995 08:46
31 lines
1864 bytes
1864 bytes
shah@wg.com wrote:
>I am developing a windows 3.1 app. This app needs to authenticate a user
>login by the user name and his/her password. I need to store this password in
>some sort of a format in some sort of a file (maybe an ini file). But first I
>need to encrypt this password and later on de-crypt to check against the
>entered password (or maybe there is a better way - I just don't know yet).
>Could any of you please point me in a better way or point me to some known
>used technique for this procedure ?
Here is some code to do it! The basic principle is simply to multiply
the ASCII code for each letter by the weighting in the string. This can
not return you the old string (ie. its one-way), so it is more secure.
However more than 1 password may have the same number after encrypting.
Hope this helps
#include <stdio.h>
void main()
{
int total = 0;
char password[20];
int i;
gets(password);
for (i = 0; i < strlen(password); total += password[i] * i++);
printf("Encrypted value is %d\n", total);
}
Al
Technical Details
Message-ID:
<409ska$9pc@speedy.cci.de>Path:
arc1-ca.pugleaf.net!cci.de!newsReferences:
<NEWTNews.807898837.21140.shah@shah.wg.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cci.de!news From: Alistair Priest <alistair@cci.de> Newsgroups: comp.os.ms-windows.programmer.tools,comp.os.ms-windows.programmer.networks,comp.os.ms-windows.programmer.misc,comp.os.ms-windows.programmer.controls,comp.os.ms-windows.apps.utilities,comp.os.ms-windows.apps.misc,comp.os.ms-windows.apps.comm,comp.lang.c++ Subject: Re: Password encryption/de-cryption Date: 9 Aug 1995 08:46:02 GMT Organization: CCI GmbH Distribution: world Message-ID: <409ska$9pc@speedy.cci.de> References: <NEWTNews.807898837.21140.shah@shah.wg.com> NNTP-Posting-Host: pcpriest.cci.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.1N (Windows; I; 16bit) To: shah@wg.com