473,738 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

crypt equivalent for Win32 platform?

I would like to use the crypt function in a Win32 (ie. C program using
Visual C++ 6.0 compiler). I wrote a little program to see if it will
link but it didn't. So I guess maybe the function isn't implement or
implemented in a different naming convention. Could someone please
help me or show me another method of doing encryption under Win32?
TIA
Nov 13 '05 #1
7 5011
ti**********@ca nada.com (Kenjis Kaan) wrote in
news:6a******** *************** ***@posting.goo gle.com:
I would like to use the crypt function in a Win32 (ie. C program using
Visual C++ 6.0 compiler). I wrote a little program to see if it will
link but it didn't. So I guess maybe the function isn't implement or
implemented in a different naming convention. Could someone please
help me or show me another method of doing encryption under Win32?


What is your question about the C language? That is, use of C syntax and
standard C libraries. Or was your question more topical in
comp.sources.wa nted?

--
- Mark ->
--
Nov 13 '05 #2
> (or google) the folks on comp.unix.progr ammer why crypt(3) isn't exactly
meant to be a generic (or even useful anymore) "encryption " algorithm. ^^^^^^^^^^^^^^^ ^^^^^^^^
- Bill


Why is it not useful anymore?? why?
Nov 13 '05 #3
On 21 Oct 2003 06:23:20 -0700, ti**********@ca nada.com (Kenjis Kaan)
wrote:
(or google) the folks on comp.unix.progr ammer why crypt(3) isn't exactly
meant to be a generic (or even useful anymore) "encryption " algorithm.

^^^^^^^^^^^^^^^ ^^^^^^^^

- Bill


Why is it not useful anymore?? why?


You should have read the part you snipped: "Try a newsgroup specific
to your platform (in this case Win32). crypt(3)
isn't ISO C,"

In other words, it's off-topic here.

--
Al Balmer
Balmer Consulting
re************* ***********@att .net
Nov 13 '05 #4
Kenjis Kaan <ti**********@c anada.com> wrote:
(or google) the folks on comp.unix.progr ammer why crypt(3) isn't exactly
meant to be a generic (or even useful anymore) "encryption " algorithm.

^^^^^^^^^^^^^^^ ^^^^^^^^

- Bill


Why is it not useful anymore?? why?


Alright, I'll bite. I wrote this last night, but decided not to post. I'm by
no means an expert, nor even possibly a novice in cryptography, but it pains
me to see people ignorant of this stuff... ;) Granted, I'm assuming there
that when you say "crypt function", you mean crypt(3), the Unix interface.
crypt(3) is an historic Unix interface. For the most part, its obsolete.
crypt(3) doesn't "encrypt". It is a one-way hash. The historic
implementation used DES (a block cipher algorIthm), however the password was
used as the key to encrypt something known (like all zeroes). The purpose
was to keep the user's password, transformed so that a plaintext password
could be matched against the stored transformed password, w/o having to keep
the plaintext password in storage (and so exposed). Indeed, in Linux's
glibc, the latest version can use MD5, a purpose built one-way hash
function, instead of DES.

I recommend you read the sci.crypt FAQ first. Playing w/ cryptologic
primitives is like playing w/ fire, except it can take a really long time
before you realize you've burned yourself, and by then its way too late to
remedy. Learn what a cipher is, a [one-way, cryptographic] hash, cipher
modes, key transformations , et al. Then consult comp.unix.progr ammer and
your preferred local Win32 newsgroup for implementations to use.

If you then find yourself having problems using one of those
implementations , and you think your issue might be pertinent to standard C,
folks here can help. Depending on what you're doing, you often have to be
careful w/ the data types you use (unsigned char vs char, int vs long, etc).
These can make huge differences w/ many crypto implementations , and its
those standard C issues which you'll be able to find quality answers for in
this group. Just the other day I found a bug in Apache's SHA1 implementation
which assumed a long was 32-bits, and the effects on my 64-bit Alpha were
interesting to say the least.
Nov 13 '05 #5
William Ahern <wi*****@wilbur .25thandClement .com> wrote in message news:<f2******* *****@wilbur.25 thandClement.co m>...
Kenjis Kaan <ti**********@c anada.com> wrote:
(or google) the folks on comp.unix.progr ammer why crypt(3) isn't exactly
meant to be a generic (or even useful anymore) "encryption " algorithm. ^^^^^^^^^^^^^^^ ^^^^^^^^
- Bill


Why is it not useful anymore?? why?


Alright, I'll bite. I wrote this last night, but decided not to post. I'm by
no means an expert, nor even possibly a novice in cryptography, but it pains
me to see people ignorant of this stuff... ;) Granted, I'm assuming there
that when you say "crypt function", you mean crypt(3), the Unix interface.
crypt(3) is an historic Unix interface. For the most part, its obsolete.
crypt(3) doesn't "encrypt". It is a one-way hash. The historic
implementation used DES (a block cipher algorIthm), however the password was
used as the key to encrypt something known (like all zeroes). The purpose
was to keep the user's password, transformed so that a plaintext password
could be matched against the stored transformed password, w/o having to keep
the plaintext password in storage (and so exposed). Indeed, in Linux's
glibc, the latest version can use MD5, a purpose built one-way hash
function, instead of DES.

I recommend you read the sci.crypt FAQ first. Playing w/ cryptologic
primitives is like playing w/ fire, except it can take a really long time
before you realize you've burned yourself, and by then its way too late to
remedy. Learn what a cipher is, a [one-way, cryptographic] hash, cipher
modes, key transformations , et al. Then consult comp.unix.progr ammer and
your preferred local Win32 newsgroup for implementations to use.

If you then find yourself having problems using one of those
implementations , and you think your issue might be pertinent to standard C,
folks here can help. Depending on what you're doing, you often have to be
careful w/ the data types you use (unsigned char vs char, int vs long, etc).
These can make huge differences w/ many crypto implementations , and its
those standard C issues which you'll be able to find quality answers for in
this group. Just the other day I found a bug in Apache's SHA1 implementation
which assumed a long was 32-bits, and the effects on my 64-bit Alpha were
interesting to say the least.

You are right crypt(3) is just a hash. But it serves what I need it
for, which is to hash/dehash a password that the user enters in the
same way that the unix login prompt process works. See what I
currently have is a webserver (apache) that provides services, however
I don't want just anyone to use it. So I am having a page that ask
for (username/password) which I then do a lookup from a RDBMS database
for the same fields (username/password), however with the (password)
field encrypted using crypt(3). Of course I use another hash key to
maintain sessions id between pages as http is connectionless. Mind
you I already got this to work on a unix environment as using the
function crypt(3) in a C or Perl program is trivial. However on Win32
is a different matter.

And now that you mentioned crypt(3) is obsolete this is raising a RED
flag and I might now have to do some investigations and relook at the
whole architecture.
I might have to throw all this out and redo it from scratch if another
way of achieving the same ends is available. This whole issue of
authenication/security is much more difficult than I had thought.
Nov 13 '05 #6
"Kenjis Kaan" wrote on 22 Oct 03:
William Ahern wrote:
Kenjis Kaan wrote:
> (or google) the folks on comp.unix.progr ammer why crypt(3) isn't exactly> meant to be a generic (or even useful anymore) "encryption "
algorithm. ^^^^^^^^^^^^^^^ ^^^^^^^^
> - Bill

Why is it not useful anymore?? why?
Alright, I'll bite. I wrote this last night, but decided not to post. I'm by no means an expert, nor even possibly a novice in cryptography, but it pains me to see people ignorant of this stuff... ;) Granted, I'm assuming there that when you say "crypt function", you mean crypt(3), the Unix interface.
crypt(3) is an historic Unix interface. For the most part, its obsolete. crypt(3) doesn't "encrypt". It is a one-way hash. The historic
implementation used DES (a block cipher algorIthm), however the password was used as the key to encrypt something known (like all zeroes). The purpose was to keep the user's password, transformed so that a plaintext password could be matched against the stored transformed password, w/o having to keep the plaintext password in storage (and so exposed). Indeed, in Linux's glibc, the latest version can use MD5, a purpose built one-way hash function, instead of DES.

I recommend you read the sci.crypt FAQ first. Playing w/ cryptologic primitives is like playing w/ fire, except it can take a really long time before you realize you've burned yourself, and by then its way too late to remedy. Learn what a cipher is, a [one-way, cryptographic] hash, cipher modes, key transformations , et al. Then consult comp.unix.progr ammer and your preferred local Win32 newsgroup for implementations to use.

If you then find yourself having problems using one of those
implementations , and you think your issue might be pertinent to standard C, folks here can help. Depending on what you're doing, you often have to be careful w/ the data types you use (unsigned char vs char, int vs long, etc). These can make huge differences w/ many crypto implementations , and its those standard C issues which you'll be able to find quality answers for in this group. Just the other day I found a bug in Apache's SHA1 implementation which assumed a long was 32-bits, and the effects on my 64-bit Alpha were interesting to say the least.


You are right crypt(3) is just a hash. But it serves what I need it
for, which is to hash/dehash a password that the user enters in the
same way that the unix login prompt process works.


By the very definition of a cryptographic hash, you cannot "de-hash"
anything: a hashing function is not reversable.
See what I
currently have is a webserver (apache) that provides services, however I don't want just anyone to use it. So I am having a page that ask
for (username/password) which I then do a lookup from a RDBMS database for the same fields (username/password), however with the (password) field encrypted using crypt(3). Of course I use another hash key to
maintain sessions id between pages as http is connectionless. Mind
you I already got this to work on a unix environment as using the
function crypt(3) in a C or Perl program is trivial. However on Win32 is a different matter.

And now that you mentioned crypt(3) is obsolete this is raising a RED flag and I might now have to do some investigations and relook at the whole architecture.
I might have to throw all this out and redo it from scratch if another way of achieving the same ends is available. This whole issue of
authenication/security is much more difficult than I had thought.


If this was going to be ported to other platforms, wouldn't it have
been a good idea to use an independent hashing algorithm? If all you
are doing is storing the hash of a password, hashing a user-supplied
password, then comparing them, can't you simply use something like MD5
or SHA-1? There are plenty of source examples around (of MD5, at
least) and it will be portable (assuming a decent implementation) . I
don't really see how such a relatively simple change could really
affect your design, either. This is the basic flow of MD5:

1) Instantiate a context structure
2) Initialise the context
3) Process data (pass the context, data, and data length - call as
many times as necessary)
4) Retreive hash

By the way, this still has nothing to do with Standard C.

Mike

--
Michael Winter
M.Winter@[no-spam]blueyonder.co.u k (remove [no-spam] to reply)
Nov 13 '05 #7

"Kenjis Kaan" <ti**********@c anada.com> wrote in message
news:6a******** *************** ***@posting.goo gle.com...
I would like to use the crypt function in a Win32 (ie. C program using
Visual C++ 6.0 compiler). I wrote a little program to see if it will
link but it didn't. So I guess maybe the function isn't implement or
implemented in a different naming convention. Could someone please
help me or show me another method of doing encryption under Win32?


Find it in one of the open source C implementation.

-- glen
Nov 13 '05 #8

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

Similar topics

3
3693
by: | last post by:
I'm curious how these two functions work together (when crypt() uses a md5 algo). Currently I know they will produce different output; is this due to the salt being used behind-the-scenes in md5()? Is there a way to allow crypt() and md5() to produce identical output or am I misunderstanding the purpose of both the functions. Thanks
2
2699
by: Paul Fournier | last post by:
Just wondering, does anyone know if the crypt() function in PHP will always return a 34 character string if not salted? I want to encrypt my user's passwords into a database and I want to make sure I give the right length. I have tried some tests on both windows platform and FreeBSD and it seems to be consistent. -- ::Paul Fournier:: ::Programmer/Analyst:: ::Center for the Digital Arts::
3
5451
by: Marco Herrn | last post by:
I want to use a crypt function to store crypted passwords. These will be used to verify mail-user access. Now the crypt() function from the module crypt is only significant for the first 8 characters. But I need more significant characters. I found the md5 and sha modules. But they work different from the crypt module. But it doesn't seem to be compatible. I need the way crypt works with a salt to verify the password. So my real...
7
2432
by: Bart Nessux | last post by:
Does Python have anything similar to Perl's Crypt::PasswdMD5??? I read about the crypt module... but it only does DES. Any plans to add md5 or other digests to it in the future?
0
2412
by: AdrianK | last post by:
I'm having a lotta problems installing Crypt::RSA on Linux Linux gogol 2.4.17smt-mono using perl5.005_03. Main problem at present is that all the tests fail with Crypt::Primes When I run a trace it looks like a segmentation fault (The same fault I am getting if I force install and run a keygen using Crypt::RSA). Any ideas/help would be appreciated. Crypt::Primes (make test)
0
2773
by: John Bergstrom | last post by:
Hello everyone! I wrote a simple perl program to encrypt a string using Crypt::OpenSSL::RSA. Everything as described in the module documentation. The public key is a valid X.509 encrypted certificate. When I tried executing the code I get the following error: -------------------
0
3084
by: Jonas | last post by:
I have the following perl program witch i use to encrypt a password file with. In perl 5.6 this program works like a charm but when trying it on the RED HAT EL 3 platform (taroon) is doesnt decrypt the encrypted string right. Program use Crypt::TripleDES; sub generate() {
0
5666
by: aars | last post by:
Hello all, I am creating a user administration system where system administrator can activate services for a user, like webspace, a mail account or a subdomain. I now want to create a function that creates mysql databases and grant the right privileges to a user. But the problem is that mysql wants to have the plaintext password for the user in the "grant ... identified by 'pwd'" field, or in a manual query to update the password in...
1
3247
by: steve | last post by:
Hi, I have a set of passwords encrypted using perl’s crypt, from a perl forum being migrated to php. I like to bring them into php, and use them without changing them. How do I emulate perl’s crypt function. I found a pear module here: http://pear.php.net/package/Crypt_CBC/docs/0.3/Crypt/Crypt_CBC.html but it seems to only take one argument, whereas perl’s crypt should
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8208
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.