Skip to content

Commit

Permalink
java 8 api sucks...
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Nov 29, 2024
1 parent f07ef0e commit 56dc34e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public ByteBuffer encryptHeader(FileHeader header) {
// general header:
result.put(Constants.UVF_MAGIC_BYTES);
result.order(ByteOrder.BIG_ENDIAN).putInt(seedId);
ByteBuffer generalHeaderBuf = result.duplicate().position(0).limit(FileHeaderImpl.UVF_GENERAL_HEADERS_LEN);
ByteBuffer generalHeaderBuf = result.duplicate();
generalHeaderBuf.position(0).limit(FileHeaderImpl.UVF_GENERAL_HEADERS_LEN);

// format-specific header:
result.put(headerImpl.getNonce());
Expand Down Expand Up @@ -90,7 +91,8 @@ public FileHeaderImpl decryptHeader(ByteBuffer ciphertextHeaderBuf) throws Authe
throw new IllegalArgumentException("Not an UVF0 file");
}
int seedId = buf.order(ByteOrder.BIG_ENDIAN).getInt();
ByteBuffer generalHeaderBuf = buf.duplicate().position(0).limit(FileHeaderImpl.UVF_GENERAL_HEADERS_LEN);
ByteBuffer generalHeaderBuf = buf.duplicate();
generalHeaderBuf.position(0).limit(FileHeaderImpl.UVF_GENERAL_HEADERS_LEN);

// format-specific header:
byte[] nonce = new byte[FileHeaderImpl.NONCE_LEN];
Expand Down

0 comments on commit 56dc34e

Please sign in to comment.