X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; q=dns; s=default; b=WL uyUW6vorPsoQW8Ga2AkYDTHr2LspUb0FfGLKL3ivULNkRzFLZ/6Ak25/Nhz/LAWZ rDhfTD+v5DKVt9ZKr5Ir8lmvXk5H0iE4lw2FO7aJri83bithnH4KyiYxcjG9Fc4T HZw/966xqXShD22R34rU3mO2KTXOeLh1vPhf21jLY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; s=default; bh=HSKXd2l3 Rfw3noQaqn3qlrSmNDg=; b=uZT55Q6+AfYQQYqkEv+vHZRAXQSvervtZRDSKwTR FOD8m4i1p9z32kDNpQ6I6fRChPzbrH+5ArZh5l50OZjDQs5tsTOyzEmMHwhxZAt5 TkIeW0NAGDPiwd1FsCysXoSexAD4jCO2x5uyNKuBY2W5i62vTBsDxrpeCiANmYp3 MkE= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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) In-Reply-To: <20160129120919.GB14874@calimero.vinschen.de> References: <56AB4F64 DOT 3070807 AT gmail DOT com> <20160129120919 DOT GB14874 AT calimero DOT vinschen DOT de> Date: Fri, 29 Jan 2016 13:56:28 +0100 Message-ID: Subject: Re: Weird behavior of crypt From: Alexandre Garnier To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes 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