Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f5207e61
Kaydet (Commit)
f5207e61
authored
Ock 14, 2014
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clinic-ize the crypt module. Derby!
üst
cc1d31e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
15 deletions
+56
-15
_cryptmodule.c
Modules/_cryptmodule.c
+56
-15
No files found.
Modules/_cryptmodule.c
Dosyayı görüntüle @
f5207e61
...
...
@@ -7,31 +7,72 @@
/* Module crypt */
/*[clinic input]
module crypt
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
static
PyObject
*
crypt_crypt
(
PyObject
*
self
,
PyObject
*
args
)
/*[clinic input]
crypt.crypt
word: 's'
salt: 's'
/
Hash a *word* with the given *salt* and return the hashed password.
*word* will usually be a user's password. *salt* (either a random 2 or 16
character string, possibly prefixed with $digit$ to indicate the method)
will be used to perturb the encryption algorithm and produce distinct
results for a given *word*.
[clinic start generated code]*/
PyDoc_STRVAR
(
crypt_crypt__doc__
,
"crypt(word, salt)
\n
"
"Hash a *word* with the given *salt* and return the hashed password.
\n
"
"
\n
"
"*word* will usually be a user
\'
s password. *salt* (either a random 2 or 16
\n
"
"character string, possibly prefixed with $digit$ to indicate the method)
\n
"
"will be used to perturb the encryption algorithm and produce distinct
\n
"
"results for a given *word*."
);
#define CRYPT_CRYPT_METHODDEF \
{"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
static
PyObject
*
crypt_crypt_impl
(
PyModuleDef
*
module
,
const
char
*
word
,
const
char
*
salt
);
static
PyObject
*
crypt_crypt
(
PyModuleDef
*
module
,
PyObject
*
args
)
{
char
*
word
,
*
salt
;
PyObject
*
return_value
=
NULL
;
const
char
*
word
;
const
char
*
salt
;
if
(
!
PyArg_ParseTuple
(
args
,
"ss:crypt"
,
&
word
,
&
salt
))
goto
exit
;
return_value
=
crypt_crypt_impl
(
module
,
word
,
salt
);
exit:
return
return_value
;
}
if
(
!
PyArg_ParseTuple
(
args
,
"ss:crypt"
,
&
word
,
&
salt
))
{
return
NULL
;
}
static
PyObject
*
crypt_crypt_impl
(
PyModuleDef
*
module
,
const
char
*
word
,
const
char
*
salt
)
/*[clinic end generated code: checksum=a137540bf6862f9935fc112b8bb1d62d6dd1ad02]*/
{
/* On some platforms (AtheOS) crypt returns NULL for an invalid
salt. Return None in that case. XXX Maybe raise an exception? */
return
Py_BuildValue
(
"s"
,
crypt
(
word
,
salt
));
}
PyDoc_STRVAR
(
crypt_crypt__doc__
,
"crypt(word, salt) -> string
\n
\
word will usually be a user's password. salt is a 2-character string
\n
\
which will be used to select one of 4096 variations of DES. The characters
\n
\
in salt must be either
\"
.
\"
,
\"
/
\"
, or an alphanumeric character. Returns
\n
\
the hashed password as a string, which will be composed of characters from
\n
\
the same alphabet as the salt."
);
static
PyMethodDef
crypt_methods
[]
=
{
{
"crypt"
,
crypt_crypt
,
METH_VARARGS
,
crypt_crypt__doc__
},
CRYPT_CRYPT_METHODDEF
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment