Add PICrypt

git-svn-id: svn://db.shs.com.ru/pip@96 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-04-15 05:25:54 +00:00
parent dbe80f4e83
commit e9e92e7e43
4 changed files with 229 additions and 13 deletions

34
src/math/picrypt.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef PICRYPT_H
#define PICRYPT_H
#include "pistring.h"
class PICrypt {
public:
PICrypt();
bool setKey(const PIByteArray &secret);
PIByteArray setKey(const PIString &secret);
PIByteArray getKey();
PIByteArray crypt(const PIByteArray &data);
PIByteArray decrypt(const PIByteArray &crypt_data, bool * ok = 0);
static PIByteArray crypt(const PIByteArray &data, const PIByteArray &secret);
static PIByteArray decrypt(const PIByteArray &crypt_data, const PIByteArray &secret, bool * ok = 0);
static PIByteArray hash(const PIString &secret);
static int sizeKey();
static int sizeCrypt();
private:
PIByteArray nonce;
PIByteArray key;
};
#endif // PICRYPT_H