java.lang.Object
dev.hloth.zgztransport.Dump
The blocks of a card, one after another, as MIFARE Classic Tool or a Proxmark
writes them.
It hides the index arithmetic a raw byte array needs, so a caller can reach for one block without slicing:
Dump dump = Dump.of(Files.readAllBytes(Path.of("dump.bin")));
Transaction newest = Transaction.decode(dump.block(TransactionLog.LIVE_BLOCK));
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFills the blocks of a dump one at a time, leaving the untouched ones zeroed. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbyte[]block(int index) One block of this dump.intHow many blocks this dump holds.static Dump.BuilderAn empty dump of the size that chip has, to be filled block by block.byte[]bytes()The bytes of this dump.card()Reads the card this dump holds.booleaninthashCode()static Dumpof(byte[] bytes) The dump those bytes hold.toString()
-
Field Details
-
BLOCK_SIZE
public static final int BLOCK_SIZEBytes one block takes.- See Also:
-
-
Method Details
-
of
The dump those bytes hold.- Parameters:
bytes- whole blocks, which are copied- Returns:
- the dump
- Throws:
CardFormatException- if the length is not a multiple of the block size
-
builder
An empty dump of the size that chip has, to be filled block by block.- Parameters:
chip- the chip whose layout the dump follows- Returns:
- a builder over a dump of
Chip.blocks()empty blocks
-
block
public byte[] block(int index) One block of this dump.- Parameters:
index- the block number, counting from zero- Returns:
- a copy of its sixteen bytes
- Throws:
CardFormatException- if the dump stops before that block
-
blockCount
public int blockCount()How many blocks this dump holds.- Returns:
- the block count
-
bytes
public byte[] bytes()The bytes of this dump.- Returns:
- a copy of them
-
card
Reads the card this dump holds.- Returns:
- the card
- Throws:
CardFormatException- if the dump stops before the last block a card uses or a block does not decode
-
equals
-
hashCode
public int hashCode() -
toString
-