From owner-freebsd-questions@freebsd.org Fri Aug 24 02:25:18 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C987109E799 for ; Fri, 24 Aug 2018 02:25:18 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (mail.cs.ait.ac.th [192.41.170.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AFCD727D2 for ; Fri, 24 Aug 2018 02:25:16 +0000 (UTC) (envelope-from Olivier.Nicole@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (localhost [127.0.0.1]) by mail.cs.ait.ac.th (Postfix) with ESMTP id 45F4B61F89 for ; Fri, 24 Aug 2018 09:25:12 +0700 (+07) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cs.ait.ac.th; h= content-type:content-type:mime-version:message-id:date:date :in-reply-to:subject:subject:from:from:received:received :received; s=selector1; t=1535077511; x=1536891912; bh=+R4oRgmA/ 3/oQ4cz6owz/JZRM1mZ89isTTHrtg+T9xM=; b=lc0WDvwUIisNgOO0NZdUYi+dY 4vbF9rAgtzQJZIR+HXL6SwTOpU6vdBd1+K74JxmQB6Fetk9OYFP9/pVsZPWtJzFT //Rr3NKpByEBBk09CxdTzEYyqYCBDppirGAuqye/Kti5w1SyU4EA1B8njYjpTnM7 A9P4mRhaw2HH3H8RHM= X-Virus-Scanned: amavisd-new at cs.ait.ac.th Received: from mail.cs.ait.ac.th ([127.0.0.1]) by mail.cs.ait.ac.th (mail.cs.ait.ac.th [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6xdeuZkzPN6H for ; Fri, 24 Aug 2018 09:25:11 +0700 (+07) Received: from banyan.cs.ait.ac.th (banyan.cs.ait.ac.th [192.41.170.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cs.ait.ac.th (Postfix) with ESMTPS id D8BB261F88 for ; Fri, 24 Aug 2018 09:25:11 +0700 (+07) Received: (from on@localhost) by banyan.cs.ait.ac.th (8.15.2/8.15.2/Submit) id w7O2PBXJ041537; Fri, 24 Aug 2018 09:25:11 +0700 (ICT) (envelope-from on@banyan.cs.ait.ac.th) From: Olivier To: freebsd-questions@freebsd.org Subject: Re: What hash to use In-Reply-To: <74a041fe-b00a-673e-c43f-b72aa04e5297@razorfever.net> (482254ac@razorfever.net) Date: Fri, 24 Aug 2018 09:25:11 +0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Aug 2018 02:25:18 -0000 "Derek (freebsd lists)" <482254ac@razorfever.net> writes: > On 2018-08-23 05:16 AM, Olivier wrote: >> I am using a tools that hashes the passwords in the form of >> $2b$10$OQBll77HJqnOR.zqK2jx8ukE6m68Azc7nrsgRdcT6bVfERRmzFV4. >> >> What magic tool can I use in freeBSD to do the same hashing? >> > > Try this (cdemo.c): > > > > Then: > > cc -lcrypt -o cdemo cdemo.c > ./cdemo > > This is okay for a one-off. > > You might wire stdin to read the salt, or for bonus points make > your own salt generator. > > Additionally, it's likely not a good idea to read the password > from the command-line (argv+argc). A file descriptor (e.g. > stdin) of some kind would be better, as it will show up in shell > history and the process table. > > Some languages, e.g. python, php, etc will have a library to do > this for you as well. Thank you Derek, I will give it a try. I started looking in Perl, but could not find anything. I am trying to automatically generate 100 accounts for a software, I don't want to create them with the web interface, so having the password on the history is not a problem (and I am asked to have the password=username, so the quality of password is not a worry :) Best regards, Olivier