Package org.microproxy.starlark.stdlib
Class HashlibModule.HashObject
java.lang.Object
org.microproxy.starlark.stdlib.HashlibModule.HashObject
- All Implemented Interfaces:
org.microproxy.thirdparty.starlark.eval.StarlarkValue
- Enclosing class:
HashlibModule
public static final class HashlibModule.HashObject
extends Object
implements org.microproxy.thirdparty.starlark.eval.StarlarkValue
A hashlib hash object.
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the underlying digest algorithm block size.copy(org.microproxy.thirdparty.starlark.eval.StarlarkThread thread) Copies the accumulated state into an independent hash object.org.microproxy.thirdparty.starlark.eval.StarlarkBytesdigest()Computes the hash of bytes fed so far without changing this object.intReturns the size of this hash result.Computes the hash as hexadecimal without changing this object.booleanReports whether the value is deeply immutable.name()Returns the hash algorithm name.voidrepr(org.microproxy.thirdparty.starlark.eval.Printer printer, org.microproxy.thirdparty.starlark.eval.StarlarkSemantics semantics) Prints an official representation of object x.voidFeeds additional bytes into this hash object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.microproxy.thirdparty.starlark.eval.StarlarkValue
checkHashable, debugPrint, getStarlarkType, isAcyclic, str, truth
-
Method Details
-
isImmutable
public boolean isImmutable()Description copied from interface:org.microproxy.thirdparty.starlark.eval.StarlarkValueReports whether the value is deeply immutable.- Specified by:
isImmutablein interfaceorg.microproxy.thirdparty.starlark.eval.StarlarkValue- Returns:
- whether this value and all values reachable from it are immutable
-
name
Returns the hash algorithm name.- Returns:
- the Python algorithm name
-
digestSize
public int digestSize()Returns the size of this hash result.- Returns:
- the output length in bytes
-
blockSize
public int blockSize()Returns the underlying digest algorithm block size.- Returns:
- the block size in bytes
-
update
Feeds additional bytes into this hash object.- Parameters:
data- the Starlark bytes to append- Throws:
org.microproxy.thirdparty.starlark.eval.EvalException- if the object is frozen or the input is not bytes
-
digest
public org.microproxy.thirdparty.starlark.eval.StarlarkBytes digest() throws org.microproxy.thirdparty.starlark.eval.EvalExceptionComputes the hash of bytes fed so far without changing this object.- Returns:
- the result as immutable bytes
- Throws:
org.microproxy.thirdparty.starlark.eval.EvalException- if the JDK provider cannot copy its state
-
hexdigest
Computes the hash as hexadecimal without changing this object.- Returns:
- the lowercase hexadecimal result
- Throws:
org.microproxy.thirdparty.starlark.eval.EvalException- if the JDK provider cannot copy its state
-
copy
public HashlibModule.HashObject copy(org.microproxy.thirdparty.starlark.eval.StarlarkThread thread) throws org.microproxy.thirdparty.starlark.eval.EvalException Copies the accumulated state into an independent hash object.- Parameters:
thread- the calling thread that owns the copy- Returns:
- a mutable copy of this object
- Throws:
org.microproxy.thirdparty.starlark.eval.EvalException- if the JDK provider cannot copy its state
-
repr
public void repr(org.microproxy.thirdparty.starlark.eval.Printer printer, org.microproxy.thirdparty.starlark.eval.StarlarkSemantics semantics) Description copied from interface:org.microproxy.thirdparty.starlark.eval.StarlarkValuePrints an official representation of object x.Convention is that the string should be parseable back to the value x. If this isn't feasible then it should be a short human-readable description enclosed in angled brackets, e.g.
"<foo object>".- Specified by:
reprin interfaceorg.microproxy.thirdparty.starlark.eval.StarlarkValue- Parameters:
printer- a printer to be used for formatting nested values.semantics- the interpreter settings used to format nested values
-