📄 trans.h
字号:
// trans.h// new transformation interface; only considers one direction at a time// (security.h is *protocol* primitives,// trans.h is *cryptographic* primitives)// copyright SafeTP Development Group, Inc., 2000 Terms of use are as specified in license.txt#ifndef __TRANS_H#define __TRANS_H#include "typ.h" // byte, boolclass DataBlock; // datablok.h// object to transform dataclass Trans {public: virtual ~Trans(); // size relationships virtual int minInputSize() const; // minimum bytes of input // default: returns 0 virtual int maxInputSize() const; // maximum bytes of input // default: returns MAXINT virtual int minOutputSize(int inputSize) const; // minimum bytes of output for a given input size // default: returns inputSize virtual int maxOutputSize(int inputSize) const; // maximum bytes of output for a given input size // default: returns inputSize // actual transform (in-place) virtual void trans(DataBlock &data); // changes 'data' to be the output // should call data.ensureAllocated(outputsize), to make sure the buffer // will be big enough under any circumstances, but also take advantage // of times when it already is // default: does nothing (identity transform) void checkingTrans(DataBlock &data); // same as 'trans', but min/maxOutputSize is verified // (for debugging purposes)};// a transform and its inverseclass TransPair {public: Trans &encoder, &decoder;public: TransPair(Trans &enc, Trans &dec) : encoder(enc), decoder(dec) {} // test that the transform+inverse pair == identity; returns true // if all tests succeed bool test(int randIters, bool echo=false); bool testBuffer(byte const *data, int length, bool echo=false); // initialize a non-crypto-strength random generator, for // calls to 'test' static void initRandom();};#endif // __TRANS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -