source: code/fastsimplexordatastore.h

Last change on this file was 23, checked in by trishank, 7 years ago

Add pre-release upPIR from June 2011.

File size: 1.6 KB
1/* Author: Justin Cappos
2 * Inspired by code from Geremy Condra
3 * File: fastsimplexordatastore.h
4 * Purpose: The header file for the fastsimplexordatastore
5 */
7#include "Python.h"
8// Needed for uint64_t on some versions of Python / GCC
9#include <stdint.h>
11typedef int datastore_descriptor;
13typedef struct {
14  long numberofblocks;      // Blocks in the datastore
15  long sizeofablock;        // Bytes in a block.   
16  char *raw_datastore;  // This points to what malloc returns...
17  uint64_t *datastore;      // This is the DWORD aligned start to the datastore
18} XORDatastore;
20// Define all of the functions...
22static inline void XOR_fullblocks(uint64_t *dest, uint64_t *data, long count);
23static inline void XOR_byteblocks(char *dest, const char *data, long count);
24static inline char *dword_align(char *ptr);
25static int is_table_entry_used(int i);
26static datastore_descriptor allocate(long block_size, long num_blocks);
27static PyObject *Allocate(PyObject *module, PyObject *args);
28static void bitstring_xor_worker(int ds, char *bit_string, long bit_string_length, uint64_t *resultbuffer);
29static PyObject *Produce_Xor_From_Bitstring(PyObject *module, PyObject *args);
30static PyObject *SetData(PyObject *module, PyObject *args);
31static PyObject *GetData(PyObject *module, PyObject *args);
32static void deallocate(datastore_descriptor ds);
33static PyObject *Deallocate(PyObject *module, PyObject *args);
34static char *slow_XOR(char *dest, const char *data, long stringlength);
35static char *fast_XOR(char *dest, const char *data, long stringlength);
36static PyObject *do_xor(PyObject *module, PyObject *args);
Note: See TracBrowser for help on using the repository browser.