https://github.com/CryptDB/cryptdb
Raw File
Tip revision: 7678bc98d3054f1418371779c6d1050cd1a88b2e authored by Raluca Ada Popa on 04 January 2014, 01:31:06 UTC
small changes to readme
Tip revision: 7678bc9
padding.hh
#pragma once

static inline void
pad_blocksize(std::string *ptext, size_t blocksize)
{
    size_t plen = ptext->size();
    uint8_t pad = blocksize - (plen % blocksize);
    ptext->resize(plen + pad);
    (*ptext)[plen + pad - 1] = pad;
}

static inline void
unpad_blocksize(std::string *ptext, size_t blocksize)
{
    size_t flen = ptext->size();
    uint8_t pad = (*ptext)[flen - 1];
    ptext->resize(flen - pad);
}
back to top