mirror of
https://github.com/nmap/nmap.git
synced 2026-08-27 03:48:14 +00:00
Remove duplicate decodeLength function
This commit is contained in:
parent
a959de5685
commit
d50c47d621
1 changed files with 0 additions and 24 deletions
|
|
@ -237,30 +237,6 @@ ASN1Decoder = {
|
|||
return pos, oid
|
||||
end,
|
||||
|
||||
---
|
||||
-- Decodes length part of encoded value according to ASN.1 basic encoding
|
||||
-- rules.
|
||||
-- @param encStr Encoded string.
|
||||
-- @param pos Current position in the string.
|
||||
-- @return The position after decoding.
|
||||
-- @return The length of the following value.
|
||||
decodeLength = function(encStr, pos)
|
||||
local elen
|
||||
pos, elen = bin.unpack('C', encStr, pos)
|
||||
if (elen > 128) then
|
||||
elen = elen - 128
|
||||
local elenCalc = 0
|
||||
local elenNext
|
||||
for i = 1, elen do
|
||||
elenCalc = elenCalc * 256
|
||||
pos, elenNext = bin.unpack("C", encStr, pos)
|
||||
elenCalc = elenCalc + elenNext
|
||||
end
|
||||
elen = elenCalc
|
||||
end
|
||||
return pos, elen
|
||||
end,
|
||||
|
||||
---
|
||||
-- Decodes an Integer according to ASN.1 basic encoding rules.
|
||||
-- @name ASN1Decoder.decodeInt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue