Top Description Inners Fields Constructors Methods
org.python.modules

public Class _hashlib

extends Object
implements ClassDictInit
Class Inheritance
All Implemented Interfaces
org.python.core.ClassDictInit
Imports
java.security.MessageDigest, .NoSuchAlgorithmException, java.util.HashMap, .Map, org.python.core.ClassDictInit, .Py, .PyArray, .PyFrozenSet, .PyObject, .PyString, .PyTuple, .PyType, .PyUnicode, .Untraversable, org.python.core.util.StringUtil, org.python.expose.ExposedGet, .ExposedMethod, .ExposedType

The Python _hashlib module: provides hashing algorithms via java.security.MessageDigest. The 'openssl' method prefix is to match CPython and provide what the pure python hashlib.py module expects.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
_hashlib.Hash

A generic wrapper around a MessageDigest.

Field Summary

Modifier and TypeField and Description
private static final Map<String, String>
algorithmMap

A mapping of Python algorithm names to MessageDigest names.

public static final PyFrozenSet

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
public static PyObject
new$(String name)

public static PyObject
new$(String name, PyObject obj)

public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
public static PyObject
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmMapback to summary
private static final Map<String, String> algorithmMap

A mapping of Python algorithm names to MessageDigest names.

openssl_md_meth_namesback to summary
public static final PyFrozenSet openssl_md_meth_names

Constructor Detail

_hashlibback to summary
public _hashlib()

Method Detail

classDictInitback to summary
public static void classDictInit(PyObject dict)
new$back to summary
public static PyObject new$(String name)
new$back to summary
public static PyObject new$(String name, PyObject obj)
openssl_md5back to summary
public static PyObject openssl_md5()
openssl_md5back to summary
public static PyObject openssl_md5(PyObject obj)
openssl_sha1back to summary
public static PyObject openssl_sha1()
openssl_sha1back to summary
public static PyObject openssl_sha1(PyObject obj)
openssl_sha224back to summary
public static PyObject openssl_sha224()
openssl_sha224back to summary
public static PyObject openssl_sha224(PyObject obj)
openssl_sha256back to summary
public static PyObject openssl_sha256()
openssl_sha256back to summary
public static PyObject openssl_sha256(PyObject obj)
openssl_sha384back to summary
public static PyObject openssl_sha384()
openssl_sha384back to summary
public static PyObject openssl_sha384(PyObject obj)
openssl_sha512back to summary
public static PyObject openssl_sha512()
openssl_sha512back to summary
public static PyObject openssl_sha512(PyObject obj)
org.python.modules back to summary

public Class _hashlib.Hash

extends PyObject
Class Inheritance
Annotations
@Untraversable
@ExposedType
name:_hashlib.HASH

A generic wrapper around a MessageDigest.

Field Summary

Modifier and TypeField and Description
private static final Map<String, Integer>
blockSizes

Supposed block sizes of algorithms for the block_size attribute.

private MessageDigest
digest

The hashing engine.

public String
name

The hash algorithm name.

public static final PyType
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
Hash(String name)

private
Hash(String name, MessageDigest digest)

Method Summary

Modifier and TypeMethod and Description
private byte[]

Returns:

a byte[] calculated digest
calculateDigest
()

Safely calculate the digest without resetting state.

private MessageDigest

Returns:

a copy of MessageDigest
cloneDigest
()

Clone the underlying MessageDigest.

public PyObject
copy()

public PyObject
public PyObject
private static MessageDigest
public int
public synchronized int
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final void
public PyObject
public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

public void
Inherited from org.python.core.PyObject:
__abs____add____and____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____cmp____coerce____coerce_ex____complex____contains____delattr____delattr____delete____delitem____delitem____delslice____delslice____dir____div____divmod____ensure_finalizer____eq____findattr____findattr____findattr_ex____finditem____finditem____finditem____float____floordiv____format____ge____get____getattr____getattr____getitem____getitem____getnewargs____getslice____getslice____gt____hash____hex____iadd____iand____idiv____idivmod____ifloordiv____ilshift____imod____imul____index____int____invert____ior____ipow____irshift____isub____iter____iternext____itruediv____ixor____le____len____long____lshift____lt____mod____mul____ne____neg____nonzero____not____oct____or____pos____pow____pow____radd____rand____rawdir____rdiv____rdivmod____reduce____reduce_ex____reduce_ex____repr____rfloordiv____rlshift____rmod____rmul____ror____rpow____rrshift____rshift____rsub____rtruediv____rxor____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice____str____sub____tojava____truediv____trunc____unicode____xor___add_and_callextra_cmp_div_divmod_doget_doget_doset_eq_floordiv_ge_gt_iadd_iand_idiv_idivmod_ifloordiv_ilshift_imod_imul_in_ior_ipow_irshift_is_isnot_isub_itruediv_ixor_jcall_jcallexc_jthrow_le_lshift_lt_mod_mul_ne_notin_or_pow_rshift_sub_truediv_unsupportedop_xoradaptToCoerceTupleasDoubleasIndexasIndexasIntasIntasIterableasLongasLongasNameasNameasStringasStringasStringOrNullasStringOrNullbit_lengthconjugatedelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypehashCodeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIndexisIntegerisMappingTypeisNumberTypeisSequenceTypemergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___subclasshook__readonlyAttributeErrorrunsupportedopMessagesetDictsetTypeunsupportedopMessage

Field Detail

blockSizesback to summary
private static final Map<String, Integer> blockSizes

Supposed block sizes of algorithms for the block_size attribute.

digestback to summary
private MessageDigest digest

The hashing engine.

nameback to summary
public String name

The hash algorithm name.

Annotations
@ExposedGet

TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

Constructor Detail

Hashback to summary
public Hash(String name)
Hashback to summary
private Hash(String name, MessageDigest digest)

Method Detail

calculateDigestback to summary
private byte[] calculateDigest()

Safely calculate the digest without resetting state.

Returns:byte[]

a byte[] calculated digest

cloneDigestback to summary
private MessageDigest cloneDigest()

Clone the underlying MessageDigest.

Returns:MessageDigest

a copy of MessageDigest

copyback to summary
public PyObject copy()
digestback to summary
public PyObject digest()
getBlockSizeback to summary
public PyObject getBlockSize()
Annotations
@ExposedGet
name:block_size
getDigestback to summary
private static MessageDigest getDigest(String name)
getDigest_sizeback to summary
public int getDigest_size()
Annotations
@ExposedGet
name:digest_size
getDigestSizeback to summary
public synchronized int getDigestSize()
Annotations
@ExposedGet
name:digestsize
HASH_copyback to summary
pack-priv final PyObject HASH_copy()
Annotations
@ExposedMethod
HASH_digestback to summary
pack-priv final PyObject HASH_digest()
Annotations
@ExposedMethod
HASH_hexdigestback to summary
pack-priv final PyObject HASH_hexdigest()
Annotations
@ExposedMethod
HASH_updateback to summary
pack-priv final void HASH_update(PyObject obj)
Annotations
@ExposedMethod
hexdigestback to summary
public PyObject hexdigest()
toStringback to summary
public String toString()

Overrides org.python.core.PyObject.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override

updateback to summary
public void update(PyObject obj)