https://github.com/CryptDB/cryptdb
Tip revision: 7678bc98d3054f1418371779c6d1050cd1a88b2e authored by Raluca Ada Popa on 04 January 2014, 01:31:06 UTC
small changes to readme
small changes to readme
Tip revision: 7678bc9
skip32.hh
#pragma once
#include <string.h>
#include <stdint.h>
#include <vector>
#include <util/errstream.hh>
class skip32 {
public:
skip32(const std::vector<uint8_t> &k) {
throw_c(k.size() == 10);
key = k;
}
void block_encrypt(const void *ptext, void *ctext) const {
memcpy(ctext, ptext, 4);
process((uint8_t*) ctext, 1);
}
void block_decrypt(const void *ctext, void *ptext) const {
memcpy(ptext, ctext, 4);
process((uint8_t*) ptext, 0);
}
static const size_t blocksize = 4;
private:
void process(uint8_t *data, int encrypt) const;
std::vector<uint8_t> key;
};