Package org.microproxy.starlark.stdlib
Class HashlibModule.HmacObject
java.lang.Object
org.microproxy.starlark.stdlib.HashlibModule.HmacObject
- All Implemented Interfaces:
org.microproxy.thirdparty.starlark.eval.StarlarkValue
- Enclosing class:
HashlibModule
public static final class HashlibModule.HmacObject
extends Object
implements org.microproxy.thirdparty.starlark.eval.StarlarkValue
An hmac HMAC 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 HMAC object.org.microproxy.thirdparty.starlark.eval.StarlarkBytesdigest()Computes the HMAC of bytes fed so far without changing this object.intReturns the size of this HMAC result.Computes the HMAC as hexadecimal without changing this object.booleanReports whether the value is deeply immutable.name()Returns the HMAC 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 HMAC 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 HMAC algorithm name.- Returns:
hmac-followed by the digest name
-
digestSize
public int digestSize()Returns the size of this HMAC 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 HMAC object.- Parameters:
msg- 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 HMAC 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 HMAC 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.HmacObject copy(org.microproxy.thirdparty.starlark.eval.StarlarkThread thread) throws org.microproxy.thirdparty.starlark.eval.EvalException Copies the accumulated state into an independent HMAC 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
-