From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46508 invoked by alias); 29 Jan 2016 12:56:33 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 46497 invoked by uid 89); 29 Jan 2016 12:56:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.7 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,LIKELY_SPAM_BODY,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=2710, $6wos, UD:UudC.lLOSB1G3D1bIboWxlixzBy2xO, UD:crypt X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 29 Jan 2016 12:56:31 +0000 Received: by mail-wm0-f47.google.com with SMTP id p63so66977778wmp.1 for ; Fri, 29 Jan 2016 04:56:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=ESIepopVOSt45Mhe8pMHeMfOJ7wcLFOP6srFlqhBkLU=; b=KLX67Vu13taSaHFOniMpu+TEw6Zi62WDe67Ph2gAZb/tiYRj1yiaLR8Krh6UAsi0G4 dG6uqIj1phxpAaXPxtEk8LJhHngLpCPNxbFvifsfTO3RSAMl+4TrOR9IPBTgN88lc4LP X13/aoS4rxA5fa9hKX3bUvC1mShLncV0z6Gy1rEoBa/2IMhxBCpqUa4AvD/Knqfao3p+ 0/Js/iYOgXMuWe9fSxbiRtbF0nvaQvg/gRc4ufCuFpnWgJw+4YkitLL8SppKWkVgv16v UxIVxXqpzpggUM6a0jrWV5VNkn37yP/aJmS/qheJEbe3gJz8V7Ms2ha/WusEwzNk/T1e 6KUQ== X-Gm-Message-State: AG10YOS58AmRNdn7Uta2Wf48MpAKloXKaT00FZOAkMtb01kJ7JTN09Gj32L4yRrVd9PyXT+/7gkzRWxEY2J9LA== MIME-Version: 1.0 X-Received: by 10.28.174.196 with SMTP id x187mr9304072wme.2.1454072188576; Fri, 29 Jan 2016 04:56:28 -0800 (PST) Received: by 10.28.73.7 with HTTP; Fri, 29 Jan 2016 04:56:28 -0800 (PST) In-Reply-To: <20160129120919.GB14874@calimero.vinschen.de> References: <56AB4F64.3070807@gmail.com> <20160129120919.GB14874@calimero.vinschen.de> Date: Fri, 29 Jan 2016 15:19:00 -0000 Message-ID: Subject: Re: Weird behavior of crypt From: Alexandre Garnier To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00468.txt.bz2 2016-01-29 13:09 GMT+01:00 Corinna Vinschen : > On Jan 29 12:39, Marco Atzeri wrote: >> >> >> On 29/01/2016 12:18, Alexandre Garnier wrote: >> >Hello. >> >I'm trying to do SHA-512 password encryption, but the result is really >> >weird on Cygwin: >> > >> ># On Cygwin(either 32 or 64) 2.4.1-1, latest updates with crypt 1.1-1, >> >libcrypt0 1.1-1, libcrypt-devel 1.1-1 >> >$ crypt '$6$7dl4B0fKUimdnR$' test_value >> >$6wOs/zKP2jDM >> > >> >$ python -c 'import crypt; print crypt.crypt("test_value", >> >"$6$7dl4B0fKUimdnR$")' # Python 2.7.10 >> >$6wOs/zKP2jDM >> > >> >$ perl -e 'print crypt("test_value", "\$6\$7dl4B0fKUimdnR\$")."\n"' # >> >Perl v5.22.1 >> >$6wOs/zKP2jDM >> > >> >Am I missing something? >> > >> >On other system, I get a more expected result: >> > >> ># On Ubuntu 15.04 >> >$ mkpasswd --method=SHA-512 test_value 7dl4B0fKUimdnR >> >$6$7dl4B0fKUimdnR$f6gCu.3IfrxhsnJKFnusDH.UudC.lLOSB1G3D1bIboWxlixzBy2xO/3rCKHmzfwekCTvmQd11bPdcsJOaLkCJ. >> > > > You're aware that the password field in /etc/passwd is not used, right? > Passwords are checked against the Windows user DB. In fact, /etc/passwd > is not necessary anymore. > >> Not SHA-512, see >> /usr/share/doc/crypt/crypt.README >> >> This is the DES-crypt package Version 1.1 >> >> It provides a static library libcrypt.a as well as a shared library >> cygcrypt-0.dll together with a link lib libcrypt.dll.a, which export >> the functions >> >> crypt(3) >> encrypt(3) >> setkey(3) >> >> The passwords created by crypt(3) are 56 bit DES encrypted and are >> 100% identical to those created by the Linux crypt(). > > Right. If you need the hashes for other purposes than /etc/passwd, > you can use `openssl sha512' My use case is to generate encrypted password for use later on unix system (using Python crypt library). OK for crypt(1) providing only 56 bit DES. But, could be nice for libcrypt (cygcrypt or crypt(3)) to provide other algorithms so other libraries working with it (like Python or Perl crypt libraries) could use those. Or at least raise an error when not supported prefixes are used (like '$6$'). -- Alex -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple