Skip to content

Commit

Permalink
Ensure the seed string output is 1024-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Mar 30, 2024
1 parent c4ef047 commit d59542c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions patches/server/0083-Matter-Secure-Seed.patch
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,10 @@ index 0000000000000000000000000000000000000000..73acd852dbe488915ee0d305fbf9429d
+}
diff --git a/src/main/java/su/plo/matter/Globals.java b/src/main/java/su/plo/matter/Globals.java
new file mode 100644
index 0000000000000000000000000000000000000000..6ba4b910ee5fba8ada455e7fa3aa6aeca02becf3
index 0000000000000000000000000000000000000000..9d544b302812c691f9046a48b51c8f7b3b30b149
--- /dev/null
+++ b/src/main/java/su/plo/matter/Globals.java
@@ -0,0 +1,90 @@
@@ -0,0 +1,96 @@
+package su.plo.matter;
+
+import com.google.common.collect.Iterables;
Expand Down Expand Up @@ -768,6 +768,12 @@ index 0000000000000000000000000000000000000000..6ba4b910ee5fba8ada455e7fa3aa6aec
+ seedBigInt = seedBigInt.shiftLeft(64).add(val);
+ }
+
+ // Ensure the output is 1024-bit length
+ int seedLength = seedBigInt.bitLength();
+ if (seedLength < 1024) {
+ seedBigInt = seedBigInt.add(BigInteger.ONE.shiftLeft(1025 - seedLength)); // Use 1025 since the first sign bit
+ }
+
+ return seedBigInt.toString();
+ }
+}
Expand Down

0 comments on commit d59542c

Please sign in to comment.