Re: [HACKERS] Tcl Implementation of crypt()
От | darcy@druid.net (D'Arcy J.M. Cain) |
---|---|
Тема | Re: [HACKERS] Tcl Implementation of crypt() |
Дата | |
Msg-id | m0y6cEz-00000oC@druid.net обсуждение исходный текст |
Ответ на | Tcl Implementation of crypt() (Phil Thompson <phil@river-bank.demon.co.uk>) |
Список | 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@{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.
В списке pgsql-hackers по дате отправления: