MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Encode

Method Encode

src/cryptlib/integer.cpp:1398–1413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398unsigned int Integer::Encode(byte *output, unsigned int outputLen, Signedness signedness) const
1399{
1400 if (signedness == UNSIGNED || NotNegative())
1401 {
1402 for (unsigned i=0; i<outputLen; i++)
1403 output[i]=GetByte(outputLen-i-1);
1404 }
1405 else
1406 {
1407 // take two's complement of *this
1408 Integer temp = Integer::Power2(8*STDMAX(ByteCount(), outputLen)) + *this;
1409 for (unsigned i=0; i<outputLen; i++)
1410 output[i]=temp.GetByte(outputLen-i-1);
1411 }
1412 return outputLen;
1413}
1414
1415unsigned int Integer::DEREncode(byte *output) const
1416{

Callers 5

EncryptMethod · 0.45
DecryptMethod · 0.45
SignMethod · 0.45
ExecuteMethod · 0.45
ToStringDisplayMethod · 0.45

Calls 1

GetByteMethod · 0.45

Tested by

no test coverage detected