diff -ruw 240402_AIMer/Additional_Implementation/aarch64/aimer128f/tree.c 240402_AIMer.patched/Additional_Implementation/aarch64/aimer128f/tree.c
--- 240402_AIMer/Additional_Implementation/aarch64/aimer128f/tree.c	2024-04-03 13:11:08.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/aarch64/aimer128f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/aarch64/aimer128s/tree.c 240402_AIMer.patched/Additional_Implementation/aarch64/aimer128s/tree.c
--- 240402_AIMer/Additional_Implementation/aarch64/aimer128s/tree.c	2024-04-03 13:11:10.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/aarch64/aimer128s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/aarch64/aimer192f/tree.c 240402_AIMer.patched/Additional_Implementation/aarch64/aimer192f/tree.c
--- 240402_AIMer/Additional_Implementation/aarch64/aimer192f/tree.c	2024-04-03 13:11:10.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/aarch64/aimer192f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/aarch64/aimer192s/tree.c 240402_AIMer.patched/Additional_Implementation/aarch64/aimer192s/tree.c
--- 240402_AIMer/Additional_Implementation/aarch64/aimer192s/tree.c	2024-04-03 13:11:12.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/aarch64/aimer192s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/aarch64/aimer256f/tree.c 240402_AIMer.patched/Additional_Implementation/aarch64/aimer256f/tree.c
--- 240402_AIMer/Additional_Implementation/aarch64/aimer256f/tree.c	2024-04-03 13:11:14.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/aarch64/aimer256f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/aarch64/aimer256s/tree.c 240402_AIMer.patched/Additional_Implementation/aarch64/aimer256s/tree.c
--- 240402_AIMer/Additional_Implementation/aarch64/aimer256s/tree.c	2024-04-03 13:11:14.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/aarch64/aimer256s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/avx2/aimer128f/tree.c 240402_AIMer.patched/Additional_Implementation/avx2/aimer128f/tree.c
--- 240402_AIMer/Additional_Implementation/avx2/aimer128f/tree.c	2024-04-03 13:11:16.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/avx2/aimer128f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/avx2/aimer128s/tree.c 240402_AIMer.patched/Additional_Implementation/avx2/aimer128s/tree.c
--- 240402_AIMer/Additional_Implementation/avx2/aimer128s/tree.c	2024-04-03 13:11:16.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/avx2/aimer128s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/avx2/aimer192f/tree.c 240402_AIMer.patched/Additional_Implementation/avx2/aimer192f/tree.c
--- 240402_AIMer/Additional_Implementation/avx2/aimer192f/tree.c	2024-04-03 13:11:18.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/avx2/aimer192f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/avx2/aimer192s/tree.c 240402_AIMer.patched/Additional_Implementation/avx2/aimer192s/tree.c
--- 240402_AIMer/Additional_Implementation/avx2/aimer192s/tree.c	2024-04-03 13:11:20.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/avx2/aimer192s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/avx2/aimer256f/tree.c 240402_AIMer.patched/Additional_Implementation/avx2/aimer256f/tree.c
--- 240402_AIMer/Additional_Implementation/avx2/aimer256f/tree.c	2024-04-03 13:11:20.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/avx2/aimer256f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Additional_Implementation/avx2/aimer256s/tree.c 240402_AIMer.patched/Additional_Implementation/avx2/aimer256s/tree.c
--- 240402_AIMer/Additional_Implementation/avx2/aimer256s/tree.c	2024-04-03 13:11:22.000000000 -0500
+++ 240402_AIMer.patched/Additional_Implementation/avx2/aimer256s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Optimized_Implementation/aimer128f/tree.c 240402_AIMer.patched/Optimized_Implementation/aimer128f/tree.c
--- 240402_AIMer/Optimized_Implementation/aimer128f/tree.c	2024-04-03 13:11:24.000000000 -0500
+++ 240402_AIMer.patched/Optimized_Implementation/aimer128f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Optimized_Implementation/aimer128s/tree.c 240402_AIMer.patched/Optimized_Implementation/aimer128s/tree.c
--- 240402_AIMer/Optimized_Implementation/aimer128s/tree.c	2024-04-03 13:11:26.000000000 -0500
+++ 240402_AIMer.patched/Optimized_Implementation/aimer128s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Optimized_Implementation/aimer192f/tree.c 240402_AIMer.patched/Optimized_Implementation/aimer192f/tree.c
--- 240402_AIMer/Optimized_Implementation/aimer192f/tree.c	2024-04-03 13:11:26.000000000 -0500
+++ 240402_AIMer.patched/Optimized_Implementation/aimer192f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Optimized_Implementation/aimer192s/tree.c 240402_AIMer.patched/Optimized_Implementation/aimer192s/tree.c
--- 240402_AIMer/Optimized_Implementation/aimer192s/tree.c	2024-04-03 13:11:28.000000000 -0500
+++ 240402_AIMer.patched/Optimized_Implementation/aimer192s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Optimized_Implementation/aimer256f/tree.c 240402_AIMer.patched/Optimized_Implementation/aimer256f/tree.c
--- 240402_AIMer/Optimized_Implementation/aimer256f/tree.c	2024-04-03 13:11:30.000000000 -0500
+++ 240402_AIMer.patched/Optimized_Implementation/aimer256f/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Optimized_Implementation/aimer256s/tree.c 240402_AIMer.patched/Optimized_Implementation/aimer256s/tree.c
--- 240402_AIMer/Optimized_Implementation/aimer256s/tree.c	2024-04-03 13:11:30.000000000 -0500
+++ 240402_AIMer.patched/Optimized_Implementation/aimer256s/tree.c	2024-04-30 09:45:01.167462640 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -131,17 +150,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES - 1][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[(index ^ 1) - 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange - 1, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Reference_Implementation/aimer128f/tree.c 240402_AIMer.patched/Reference_Implementation/aimer128f/tree.c
--- 240402_AIMer/Reference_Implementation/aimer128f/tree.c	2024-04-03 13:11:32.000000000 -0500
+++ 240402_AIMer.patched/Reference_Implementation/aimer128f/tree.c	2024-04-30 09:41:01.237897838 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -44,17 +63,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[index ^ 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Reference_Implementation/aimer128s/tree.c 240402_AIMer.patched/Reference_Implementation/aimer128s/tree.c
--- 240402_AIMer/Reference_Implementation/aimer128s/tree.c	2024-04-03 13:11:34.000000000 -0500
+++ 240402_AIMer.patched/Reference_Implementation/aimer128s/tree.c	2024-04-30 09:41:01.237897838 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -44,17 +63,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[index ^ 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Reference_Implementation/aimer192f/tree.c 240402_AIMer.patched/Reference_Implementation/aimer192f/tree.c
--- 240402_AIMer/Reference_Implementation/aimer192f/tree.c	2024-04-03 13:11:34.000000000 -0500
+++ 240402_AIMer.patched/Reference_Implementation/aimer192f/tree.c	2024-04-30 09:41:01.237897838 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -44,17 +63,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[index ^ 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Reference_Implementation/aimer192s/tree.c 240402_AIMer.patched/Reference_Implementation/aimer192s/tree.c
--- 240402_AIMer/Reference_Implementation/aimer192s/tree.c	2024-04-03 13:11:36.000000000 -0500
+++ 240402_AIMer.patched/Reference_Implementation/aimer192s/tree.c	2024-04-30 09:41:01.237897838 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -44,17 +63,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[index ^ 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Reference_Implementation/aimer256f/tree.c 240402_AIMer.patched/Reference_Implementation/aimer256f/tree.c
--- 240402_AIMer/Reference_Implementation/aimer256f/tree.c	2024-04-03 13:11:36.000000000 -0500
+++ 240402_AIMer.patched/Reference_Implementation/aimer256f/tree.c	2024-04-30 09:41:01.237897838 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -44,17 +63,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[index ^ 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
diff -ruw 240402_AIMer/Reference_Implementation/aimer256s/tree.c 240402_AIMer.patched/Reference_Implementation/aimer256s/tree.c
--- 240402_AIMer/Reference_Implementation/aimer256s/tree.c	2024-04-03 13:11:38.000000000 -0500
+++ 240402_AIMer.patched/Reference_Implementation/aimer256s/tree.c	2024-04-30 09:41:01.237897838 -0500
@@ -5,6 +5,25 @@
 #include "tree.h"
 #include "hash.h"
 
+#include "crypto_int64.h"
+
+static void lookup(uint8_t out[AIMER_SEED_SIZE],
+                   const uint8_t (*in)[AIMER_SEED_SIZE],
+                   crypto_int64 inlen,
+                   crypto_int64 inpos)
+{
+  size_t i, j;
+  memset(out,0,AIMER_SEED_SIZE);
+  for (i = 0;i < inlen;++i) {
+    crypto_int64 mask = crypto_int64_equal_mask(i,inpos);
+    for (j = 0;j < AIMER_SEED_SIZE;++j)
+      out[j] |= mask & in[i][j];
+  }
+}
+
+
+
+
 void expand_seed(const uint8_t seed[AIMER_SEED_SIZE],
                  const uint8_t salt[AIMER_SALT_SIZE],
                  const size_t rep_index,
@@ -44,17 +63,16 @@
 }
 
 void reveal_all_but(const uint8_t nodes[2 * AIMER_NUM_MPC_PARTIES][AIMER_SEED_SIZE],
-                    const size_t cover_index,
+                    size_t index,
                     uint8_t reveal_path[AIMER_NUM_MPC_PARTIES_LOG2][AIMER_SEED_SIZE])
 {
-  size_t index = cover_index + AIMER_NUM_MPC_PARTIES;
+  size_t indexrange = AIMER_NUM_MPC_PARTIES;
   for (size_t depth = 0; depth < AIMER_NUM_MPC_PARTIES_LOG2; depth++)
   {
-    // index ^ 1 is sibling index
-    memcpy(reveal_path[depth], nodes[index ^ 1], AIMER_SEED_SIZE);
-
+    lookup(reveal_path[depth], nodes + indexrange, indexrange, index ^ 1);
     // go to parent node
     index >>= 1;
+    indexrange >>= 1;
   }
 }
 
