diff --git a/crates/lox-library/src/lib.rs b/crates/lox-library/src/lib.rs index 49cf76f..fdba6e4 100644 --- a/crates/lox-library/src/lib.rs +++ b/crates/lox-library/src/lib.rs @@ -368,7 +368,7 @@ impl BridgeAuth { if let Some(v) = positions { for (bucketnum, offset) in v.iter() { println!("Bucket num: {:?} and offset: {:?}", bucketnum, offset); - let bridgelines = match self.bridge_table.buckets.get(bucketnum) { + let mut bridgelines = match self.bridge_table.buckets.get(bucketnum) { Some(bridgelines) => *bridgelines, None => return res, }; @@ -526,14 +526,15 @@ impl BridgeAuth { if let Some(v) = positions { for (bucketnum, offset) in v.iter() { // Count how many bridges in this bucket are reachable - let numreachable = self.bridge_table.buckets[*bucketnum as usize] + let mut bucket = self.bridge_table.buckets.get(bucketnum).unwrap(); + let numreachable = bucket .iter() .filter(|br| self.bridge_table.reachable.get(br).is_some()) .count(); // Remove the bridge from the bucket - assert!(self.bridge_table.buckets[*bucketnum as usize][*offset] == *bridge); - self.bridge_table.buckets[*bucketnum as usize][*offset] = BridgeLine::default(); + assert!(bucket[*offset] == *bridge); + bucket[*offset] = BridgeLine::default(); // Is this bucket an open-invitation bucket? if bdb.openinv_buckets.contains(bucketnum) { diff --git a/crates/lox-library/src/migration_table.rs b/crates/lox-library/src/migration_table.rs index 9f98c34..5697b00 100644 --- a/crates/lox-library/src/migration_table.rs +++ b/crates/lox-library/src/migration_table.rs @@ -159,8 +159,8 @@ pub fn encrypt_cred_ids( migrationkey_priv: &IssuerPrivKey, ) -> Option<([u8; 16], [u8; ENC_MIGRATION_BYTES])> { // Look up the bucket keys and form the attributes (Scalars) - let fromkey = bridgetable.keys.get(from_id as usize)?; - let tokey = bridgetable.keys.get(to_id as usize)?; + let fromkey = bridgetable.keys.get(&from_id)?; + let tokey = bridgetable.keys.get(&to_id)?; Some(encrypt_cred( id, &bridge_table::to_scalar(from_id, fromkey),