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 Type
    Method
    Description
    int
    Returns 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.StarlarkBytes
    Computes the HMAC of bytes fed so far without changing this object.
    int
    Returns the size of this HMAC result.
    Computes the HMAC as hexadecimal without changing this object.
    boolean
    Reports whether the value is deeply immutable.
    Returns the HMAC algorithm name.
    void
    repr(org.microproxy.thirdparty.starlark.eval.Printer printer, org.microproxy.thirdparty.starlark.eval.StarlarkSemantics semantics)
    Prints an official representation of object x.
    void
    Feeds additional bytes into this HMAC object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods 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.StarlarkValue
      Reports whether the value is deeply immutable.
      Specified by:
      isImmutable in interface org.microproxy.thirdparty.starlark.eval.StarlarkValue
      Returns:
      whether this value and all values reachable from it are immutable
    • name

      public String 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

      public void update(Object msg) throws org.microproxy.thirdparty.starlark.eval.EvalException
      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.EvalException
      Computes 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

      public String hexdigest() throws org.microproxy.thirdparty.starlark.eval.EvalException
      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.StarlarkValue
      Prints 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:
      repr in interface org.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