From: | darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain) |
---|---|
To: | phil(at)river-bank(dot)demon(dot)co(dot)uk (Phil Thompson) |
Cc: | pgsql-hackers(at)postgreSQL(dot)org (PostgreSQL Hackers) |
Subject: | Re: [HACKERS] Tcl Implementation of crypt() |
Date: | 1998-02-22 14:18:49 |
Message-ID: | m0y6cEz-00000oC@druid.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thus spake Phil Thompson
> Somebody mentioned they had a Tcl implementation of crypt() the other
> day but I've deleted the message. Could you send me a copy?
Would this help? Just add includes and an init function to register it.
I also have a Python function if anyone needs it.
static const char *ach[] = {
"abcdefghijkamnbpqrstuvwxyzABCDEFGHcJKLMNdPQRSTUVWXYZ123456789eAB",
"abcdefghjkamnbpqrstuvwxyzabcdefghcjkmndpqrstuvwxyzxyz23456789eab",
"ABCDEFGHJKAMNBPQRSTUVWXYZABCDEFGHCJKMNDPQRSTUVWXYZXYZ23456789EAB",
};
/*
usage:
te_crypt <password>
Encrypts a password
Returns:
The password in its encrypted form.
*/
int
te_crypt(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
{
char salt[8];
static int initflag = 1;
if (argc != 2)
{
Tcl_AppendResult(interp, "crypt: Invalid number of arguments", 0);
return TCL_ERROR;
}
if (initflag)
srandom(time(NULL));
initflag = 0;
salt[0] = ach[0][random() % 64];
salt[1] = ach[0][random() % 64];
salt[2] = 0;
Tcl_AppendResult(interp, crypt(argv[1], salt), 0);
return TCL_OK;
}
--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.
From | Date | Subject | |
---|---|---|---|
Next Message | Keith Parks | 1998-02-22 14:50:28 | SIGSEGV in sebselect. |
Previous Message | Vadim B. Mikheev | 1998-02-22 12:18:23 | Re: [HACKERS] Open 6.3 issues |