pwhash - added -x option
JP <[email protected]> Mon, 26 Nov 2018 10:38:44 -0500
| Newsgroups | gmane.os.netbsd.devel.crypto |
|---|---|
| Message-ID | <CAHN8Bqp1cDmGJOsV2_84peQrs8AQ7b9ifvyzCjZBxv076onbcw@mail.gmail.com> |
--0000000000008971a4057b9321c2
Content-Type: text/plain; charset="UTF-8"
I have the need to check against hashes generated by pwhash (I have a CGI
script doing logins). I'd like an option in pwhash to explicitly specify
the setting for crypt() (rather than create a whole separate binary). The
-s option almost does this except that it verifies that there is no $ in
the optarg (to ensure DES), so the changes to the source are minimal (5
lines). I added a -x, the option argument explicitly specifies the crypt()
setting.
Anyway, just thought someone else might be interested.
JP
P.S. I'm not sure how to submit patches, but I ran `cvs diff` in
/usr/src/usr.bin/pwhash and this is the output
Index: pwhash.c
===================================================================
RCS file: /cvsroot/src/usr.bin/pwhash/pwhash.c,v
retrieving revision 1.15
diff -r1.15 pwhash.c
56a57
> #define DO_CRYPT 5
63c64
< "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-p | string]\n",
---
> "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-x setting] [-p | string]\n",
118a120
> case DO_CRYPT:
149c151
< while ((opt = getopt(argc, argv, "kmpS:s:b:")) != -1) {
---
> while ((opt = getopt(argc, argv, "kmpS:s:b:x:")) != -1) {
179a182
> case 'x':
--0000000000008971a4057b9321c2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I have the need to check against hashes generated by =
pwhash (I have a CGI script doing logins).=C2=A0 I'd like an option in =
pwhash to explicitly specify the setting for crypt() (rather than create a =
whole separate binary).=C2=A0 The -s option almost does this except that it=
verifies that there is no $ in the optarg (to ensure DES), so the changes =
to the source are minimal (5 lines).=C2=A0 I added a -x, the option argumen=
t explicitly specifies the crypt() setting.<br></div><div><br></div><div>An=
yway, just thought someone else might be interested.</div><div><br></div><d=
iv>JP<br></div><div><br></div><div>P.S.=C2=A0 I'm not sure how to submi=
t patches, but I ran `cvs diff` in /usr/src/usr.bin/pwhash and this is the =
output</div><div><br></div><div>
<pre>Index: pwhash.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/usr.bin/pwhash/pwhash.c,v
retrieving revision 1.15
diff -r1.15 pwhash.c
56a57
> #define DO_CRYPT 5
63c64
< "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-p | str=
ing]\n",
---
> "Usage: %s [-km] [-b rounds] [-S rounds] [-s salt] [-x setti=
ng] [-p | string]\n",
118a120
> case DO_CRYPT:
149c151
< while ((opt =3D getopt(argc, argv, "kmpS:s:b:")) !=3D -1) {
---
> while ((opt =3D getopt(argc, argv, "kmpS:s:b:x:")) !=3D -1)=
{
179a182
> case 'x':</pre>
</div></div>
--0000000000008971a4057b9321c2--