Struct mc_oblivious_map::CuckooHashTable[][src]

pub struct CuckooHashTable<KeySize, ValueSize, BlockSize, RngType, O> where
    KeySize: ArrayLength<u8> + Add<ValueSize> + PartialDiv<U8> + 'static,
    ValueSize: ArrayLength<u8> + PartialDiv<U8>,
    BlockSize: ArrayLength<u8> + PartialDiv<U8>,
    RngType: RngCore + CryptoRng + Send + Sync + 'static,
    O: ORAM<BlockSize> + Send + Sync + 'static,
    Sum<KeySize, ValueSize>: ArrayLength<u8> + Sub<KeySize, Output = ValueSize> + PartialDiv<U8>, 
{ /* fields omitted */ }

A bucketed cuckoo hash table built on top of oblivious storage.

The Block stored by ORAM is considered as a bucket in the hashing algorithm. The bucket gets broken up into aligned chunks of size KeySize + ValueSize, so the number of items in a bucket is BlockSize / (KeySize + ValueSize)

Implementations

impl<KeySize, ValueSize, BlockSize, RngType, O> CuckooHashTable<KeySize, ValueSize, BlockSize, RngType, O> where
    KeySize: ArrayLength<u8> + Add<ValueSize> + PartialDiv<U8> + 'static,
    ValueSize: ArrayLength<u8> + PartialDiv<U8>,
    BlockSize: ArrayLength<u8> + PartialDiv<U8>,
    RngType: RngCore + CryptoRng + Send + Sync + 'static,
    O: ORAM<BlockSize> + Send + Sync + 'static,
    Sum<KeySize, ValueSize>: ArrayLength<u8> + Sub<KeySize, Output = ValueSize> + PartialDiv<U8>, 
[src]

pub fn new<OC, M>(desired_capacity: u64, stash_size: usize, maker: M) -> Self where
    OC: ORAMCreator<BlockSize, RngType, Output = O>,
    M: 'static + FnMut() -> RngType, 
[src]

Create a new hashmap The ORAM should be default initialized or bad things will happen

Trait Implementations

impl<KeySize, ValueSize, BlockSize, RngType, O> ObliviousHashMap<KeySize, ValueSize> for CuckooHashTable<KeySize, ValueSize, BlockSize, RngType, O> where
    KeySize: ArrayLength<u8> + Add<ValueSize> + PartialDiv<U8> + 'static,
    ValueSize: ArrayLength<u8> + PartialDiv<U8>,
    BlockSize: ArrayLength<u8> + PartialDiv<U8>,
    RngType: RngCore + CryptoRng + Send + Sync + 'static,
    O: ORAM<BlockSize> + Send + Sync + 'static,
    Sum<KeySize, ValueSize>: ArrayLength<u8> + Sub<KeySize, Output = ValueSize> + PartialDiv<U8>, 
[src]

fn read(
    &mut self,
    query: &A8Bytes<KeySize>,
    output: &mut A8Bytes<ValueSize>
) -> u32
[src]

To read: Early return if the query is all zero bytes Hash the query (twice) Load the corresponding blocks from ORAM (one at a time) Interpret block as [(KeySize, ValueSize)] Ct-compare the found key with the query If successful, cmov OMAP_FOUND onto result_code and cmov value onto result. Return result_code and result after scanning both loaded blocks

fn access<F: FnOnce(u32, &mut A8Bytes<ValueSize>)>(
    &mut self,
    query: &A8Bytes<KeySize>,
    f: F
)
[src]

For access: Access must be fully oblivious, unlike write

  • Checkout both buckets, scan them for the query, copying onto a stack buffer
  • Run callback at the stack buffer
  • Scan the buckets again and overwrite the old buffer

fn vartime_write_extended(
    &mut self,
    query: &A8Bytes<KeySize>,
    new_value: &A8Bytes<ValueSize>,
    allow_overwrite: Choice,
    allow_sideeffects_and_eviction: Choice
) -> u32
[src]

For writing: The insertion algorithm is, hash the item twice and load its buckets. We always add to the less loaded of the two buckets, breaking ties to the right, that is, prefering to write to oram2. If BOTH buckets overflow, then we choose an item at random from oram1 bucket and kick it out, then we hash that item and insert it into the other bucket where it can go, repeating the process if necessary. If after a few tries it doesn’t work, we give up, roll everything back, and return OMAP_OVERFLOW.

The access function is an alternative that allows modifying values in the map without taking a variable amount of time.

Auto Trait Implementations

impl<KeySize, ValueSize, BlockSize, RngType, O> Send for CuckooHashTable<KeySize, ValueSize, BlockSize, RngType, O>

impl<KeySize, ValueSize, BlockSize, RngType, O> Sync for CuckooHashTable<KeySize, ValueSize, BlockSize, RngType, O>

impl<KeySize, ValueSize, BlockSize, RngType, O> Unpin for CuckooHashTable<KeySize, ValueSize, BlockSize, RngType, O> where
    O: Unpin,
    RngType: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.