MCPcopy Create free account
hub / github.com/LUX-Core/lux / DERLengthEncode

Function DERLengthEncode

src/cryptopp/asn.cpp:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16/// DER Length
17size_t DERLengthEncode(BufferedTransformation &bt, lword length)
18{
19 size_t i=0;
20 if (length <= 0x7f)
21 {
22 bt.Put(byte(length));
23 i++;
24 }
25 else
26 {
27 bt.Put(byte(BytePrecision(length) | 0x80));
28 i++;
29 for (int j=BytePrecision(length); j; --j)
30 {
31 bt.Put(byte(length >> (j-1)*8));
32 i++;
33 }
34 }
35 return i;
36}
37
38bool BERLengthDecode(BufferedTransformation &bt, lword &length, bool &definiteLength)
39{

Callers 6

DEREncodeOctetStringFunction · 0.85
DEREncodeTextStringFunction · 0.85
DEREncodeBitStringFunction · 0.85
DEREncodeMethod · 0.85
MessageEndMethod · 0.85
DEREncodeUnsignedFunction · 0.85

Calls 2

BytePrecisionFunction · 0.85
PutMethod · 0.45

Tested by

no test coverage detected