Class Key

java.lang.Object
dev.hloth.zgztransport.Key

public final class Key extends Object
A six byte MIFARE Classic sector key.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Bytes a key takes.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The bytes of this key.
    boolean
    equals(Object other)
     
    int
     
    static Key
    of(byte[] bytes)
    The key those bytes hold.
    static Key
    of(String hex)
    The key those twelve hex digits spell, as key tables and dump tools print them.
    The key as twelve upper case hex digits.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • of

      public static Key of(byte[] bytes)
      The key those bytes hold.
      Parameters:
      bytes - the six bytes, which are copied
      Returns:
      the key
      Throws:
      CardFormatException - if the input is not six bytes
    • of

      public static Key of(String hex)
      The key those twelve hex digits spell, as key tables and dump tools print them.
      Parameters:
      hex - the twelve hex digits, in either case
      Returns:
      the key
      Throws:
      IllegalArgumentException - if the text is not twelve hex digits
    • bytes

      public byte[] bytes()
      The bytes of this key.
      Returns:
      a copy of the six bytes
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      The key as twelve upper case hex digits.
      Overrides:
      toString in class Object
      Returns:
      the printed key